Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product description behaviour when duplicating product #24701

Open
2 tasks
maciej-laskowski opened this issue Sep 27, 2019 · 2 comments
Open
2 tasks

Product description behaviour when duplicating product #24701

maciej-laskowski opened this issue Sep 27, 2019 · 2 comments
Labels
focus: product management Related to product creation and editing. plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Mothra WC Merchants activation and store management type: bug The issue is a confirmed bug.

Comments

@maciej-laskowski
Copy link

Prerequisites

  • [x ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate
  • The issue still exists against the latest master branch of WooCommerce on Github (this is not the same version as on WordPress.org!)
  • [x ] I have attempted to find the simplest possible steps to reproduce the issue
  • I have included a failing test as a pull request (Optional)

Steps to reproduce the issue

  1. Install WP+WC+Storefront
  2. Add the following code as a plugin and activate it
<?php /* Plugin Name: Product duplication description bug */

add_filter( 'woocommerce_product_get_description', function(string $value, WC_Product $product): string{
    return $value.' some dynamic content';
}, 100, 2);
  1. Add new product with description "description" and publish it
  2. Click "duplicate to a new draft"
  3. Duplicated product will have description "description some dynamic content"

Expected/actual behavior

I believe when duplicating the product only raw description should be cloned and persited in the db. Expected description on duplicated product is "description" that way $product->get_description() === $duplicate->get_description()

Isolating the problem

  • [x ] This bug happens with only WooCommerce plugin active
  • [x ] This bug happens with a default WordPress theme active, or Storefront
  • [x ] I can reproduce this bug consistently using the steps above

WordPress Environment

` ### WordPress Environment ###

WordPress address (URL): http://localhost/wp
Site address (URL): http://localhost/wp
WC Version: 3.7.0
REST API Version: ✔ 1.0.2
Log Directory Writable: ✔
WP Version: 5.2.3
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: pl_PL
External object cache: –

Server Environment

Server Info: Apache/2.4.38 (Win64) OpenSSL/1.1.1b PHP/7.3.3
PHP Version: 7.3.3
PHP Post Max Size: 256 MB
PHP Time Limit: 6000
PHP Max Input Vars: 1000
cURL Version: 7.64.0
OpenSSL/1.1.1b

SUHOSIN Installed: –
MySQL Version: 5.5.5-10.1.38-MariaDB
Max Upload Size: 256 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 3.7.0
WC Database Prefix: wp_
MaxMind GeoIP Database: ✔
Całkowity rozmiar bazy danych: 1.76MB
Rozmiar bazy danych: 0.80MB
Rozmiar indeksu bazy danych: 0.96MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_options: Data: 0.22MB + Index: 0.02MB + Engine InnoDB
wp_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_posts: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB

Security

Secure connection (HTTPS): ❌
Twój sklep nie używa protokołu HTTPS. Dowiedz się więcej o HTTPS i certyfikatach SSL .
Hide errors from visitors: ❌Komunikaty o błędach nie powinny być widoczne dla użytkowników.

Active Plugins (2)

Product duplication bugs: przez –
WooCommerce: przez Automattic – 3.7.0

Inactive Plugins (0)

Settings

API Enabled: –
Force SSL: –
Currency: GBP (£)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to WooCommerce.com: –

WC Pages

Strona sklepu: #32 - /sklep/
Koszyk: #33 - /koszyk/
Zamówienie: #34 - /zamowienie/
Moje konto: #35 - /moje-konto/
Regulamin: ❌ Strona nie ustawiona

Theme

Name: Storefront
Version: 2.5.3
Author URL: https://woocommerce.com/
Child Theme: ❌ – Jeśli modyfikujesz WooCommerce lub motyw nadrzędny
którego nie jesteś autorem
polecamy używanie motywu potomnego. Zobacz: Jak tworzyć motywy potomne

WooCommerce Support: ✔

Templates

Overrides: –

Action Scheduler

Complete: 3
Oldest: 2019-09-27 12:59:48 +0200
Newest: 2019-09-27 13:00:58 +0200

Pending: 0
Oldest: –
Newest: –

Canceled: 0
Oldest: –
Newest: –

In-progress: 0
Oldest: –
Newest: –

Failed: 0
Oldest: –
Newest: –

`

@peterfabian peterfabian added priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug. labels Oct 2, 2019
@juliaamosova juliaamosova modified the milestone: 3.9.0 Nov 20, 2019
@crstauf
Copy link
Contributor

crstauf commented Feb 28, 2020

Interestingly, the context used by the CRUD method calls in WC_Product_Data_Store_CPT->create() is view, while the context in WC_Product_Data_Store_CPT->update() is edit.

I don't think create() is used in the duplication process, just something interesting I found while poking around.

@crstauf
Copy link
Contributor

crstauf commented Feb 28, 2020

Uhp, I change my mind.

I don't think create() is used in the duplication process

WC_Admin_Duplicate_Product->product_duplicate() sets the duplicate product's ID to 0, and then when the duplicate product is saved (WC_Product->save()), the save() function calls create().

@ObliviousHarmony ObliviousHarmony added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 21, 2022
@rrennick rrennick added focus: product management Related to product creation and editing. team: Mothra WC Merchants activation and store management labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: product management Related to product creation and editing. plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Mothra WC Merchants activation and store management type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

6 participants