hyyan / woo-poly-integration

Looking for maintainers! - Wordpress WooCommerce Polylang Integration
https://wordpress.org/plugins-wp/woo-poly-integration/
MIT License
183 stars 66 forks source link

Empty Regular Price in Variable Products not Sync to other languages #313

Closed tasqon closed 5 years ago

tasqon commented 6 years ago

I have variable products in 6 languages. Changing the Regular Price by leaving the field empty does change the product in the main language but not the other five language.

Can you reproduce this issue on default Wordpress theme (eg Storefront)?

Yes

Can you reproduce this issue when all other plugins are disabled except WooCommerce, Polylang and Hyyan WooCommerce Polylang Integration?

Yes

What product versions and settings are you using when this issue occurs?

Steps to Reproduce

  1. Selecting in the main language a Variable Product for which some language variants exists
  2. Click on Edit
  3. Click on Attibutes
  4. Click on Variations
  5. Select in Drop Down Box under Pricing "Set regular prices" and click "Go"
  6. Leave "Enter a value" field empty and click "Ok"
  7. Click in the Edit Product form on "Update"

What I Expected

After clicking on "Update" I expect that for the main language AND all other languages the Variable Product regular price change to "empty".

What Happened Instead

The Variable Product regular price ONLY changes for the main language. The other languages keep unchanged.

WordPress Environment

` ### WordPress Environment ### Home URL: http://localhost/tasqon.com Site URL: http://localhost/tasqon.com WC Version: 3.3.3 Log Directory Writable: ✔ WP Version: 4.9.4 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US ### Server Environment ### Server Info: Apache/2.4.27 (Win64) PHP/5.6.31 PHP Version: 5.6.31 PHP Post Max Size: 8 MB PHP Time Limit: 120 PHP Max Input Vars: 2500 cURL Version: 7.51.0 OpenSSL/1.0.2k SUHOSIN Installed: – MySQL Version: 5.7.19 Max Upload Size: 2 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 3.3.3 WC Database Prefix: wp_ MaxMind GeoIP Database: ✔ Total Database Size: 10.33MB Database Data Size: 6.52MB Database Index Size: 3.81MB wp_woocommerce_sessions: Data: 0.00MB + Index: 0.00MB wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.00MB wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB wp_woocommerce_order_items: Data: 0.00MB + Index: 0.00MB wp_woocommerce_order_itemmeta: Data: 0.00MB + Index: 0.00MB wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.00MB wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB wp_commentmeta: Data: 0.00MB + Index: 0.01MB wp_options: Data: 0.99MB + Index: 0.08MB wp_postmeta: Data: 4.51MB + Index: 2.97MB wp_posts: Data: 0.76MB + Index: 0.29MB wp_statistics_exclusions: Data: 0.00MB + Index: 0.00MB wp_statistics_historical: Data: 0.00MB + Index: 0.00MB wp_statistics_pages: Data: 0.00MB + Index: 0.02MB wp_statistics_search: Data: 0.00MB + Index: 0.00MB wp_statistics_useronline: Data: 0.00MB + Index: 0.00MB wp_statistics_visit: Data: 0.00MB + Index: 0.00MB wp_statistics_visitor: Data: 0.00MB + Index: 0.02MB wp_termmeta: Data: 0.03MB + Index: 0.04MB wp_terms: Data: 0.04MB + Index: 0.06MB wp_term_relationships: Data: 0.11MB + Index: 0.24MB wp_term_taxonomy: Data: 0.08MB + Index: 0.06MB wp_usermeta: Data: 0.00MB + Index: 0.01MB wp_users: Data: 0.00MB + Index: 0.01MB wp_wc_download_log: Data: 0.00MB + Index: 0.00MB wp_wc_webhooks: Data: 0.00MB + Index: 0.00MB ### Post Type Counts ### amn_wpforms-lite: 1 attachment: 438 customize_changeset: 57 nav_menu_item: 133 page: 124 polylang_mo: 6 post: 2 product: 337 product_variation: 1476 revision: 351 wpforms: 6 ### Security ### Secure connection (HTTPS): ❌Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates. Hide errors from visitors: ✔ ### Active Plugins (3) ### Polylang: by Frédéric Demarle – 2.3.2 Hyyan WooCommerce Polylang Integration: by Hyyan Abo Fakher – 1.0.4 – Not tested with the active version of WooCommerce WooCommerce: by Automattic – 3.3.3 ### Settings ### API Enabled: ✔ Force SSL: – Currency: EUR (€) 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) ### WC Pages ### Shop base: #191 - /products/ Cart: #192 - /cart/ Checkout: #193 - /checkout/ My account: #194 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Storefront Version: 2.2.8 Author URL: https://woocommerce.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ ### Templates ### Overrides: – `
Jon007 commented 6 years ago

what is the intended purpose of setting the price field to empty? as there may be various other ways of achieving the intended purpose.

tasqon commented 6 years ago

in wholesale one want show the products and its variations but not the price.

Jon007 commented 6 years ago

right...
apart from solving this issue, there are several solutions to hiding prices including some plugins .. apart from any other options also check the filter woocommerce_get_price_html For example some code like this could be added to hide all prices:

add_filter( 'woocommerce_get_price_html', 'hide_price', 10, 2);
function hide_price($pricehtml, $product){
   return '';
}

you could also test some attribute of the $product to hide prices based on a rule

Jon007 commented 5 years ago

I would say this is not a bug because variation price is a mandatory field, it is not allowed to be set to empty. And for the other fields the blank values are synchronising fine, so they should do for price as well if price is modified to be optional...
A separate matter is how to hide the price if you do not want to show prices on the front end.