woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.41k stars 10.76k forks source link

Product not put on Sale after importing data thru CSV #38757

Closed xue28 closed 1 year ago

xue28 commented 1 year ago

Prerequisites

Describe the bug

Product is not put on sale when data is imported from CSV, though data has been imported successfully.

CSV File: image

Product Edit: image

Output on Single Product Page: image

However, the same setup works when you set this up manually on the product edit page.

Expected behavior

Product should be put on sale with the Sale badge as well as the discounted price on the Single Product Page.

image

Actual behavior

Data was imported successfully via the built-in Product CSV Importer and Exporter, however, it is not reflected on the single product page.

image

Steps to reproduce

  1. Create a CSV file that includes the following fields: Product ID, Date Sale Starts, Date Sale Ends, Regular Price and Sale Price
  2. Import the CSV file using the built-in Product CSV Importer and Exporter
  3. Check the product edit page to see if the data was imported successfully
  4. Check the single product page if the changes have been reflected

WordPress Environment

`

WordPress Environment

WordPress address (URL): Site address (URL): WC Version: 7.8.0 REST API Version: ✔ 7.8.0 WC Blocks Version: ✔ 10.4.2 Action Scheduler Version: ✔ 3.5.4 Log Directory Writable: ✔ WP Version: 6.2.2 WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: ✔

Server Environment

Server Info: nginx PHP Version: 7.4.33 PHP Post Max Size: 2 GB PHP Time Limit: 1200 PHP Max Input Vars: 6144 cURL Version: 8.0.1 OpenSSL/1.1.1n

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

Database

WC Database Version: 7.8.0 WC Database Prefix: wp_ Total Database Size: 46.91MB Database Data Size: 33.71MB Database Index Size: 13.20MB wp_woocommerce_sessions: Data: 1.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.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.19MB + Index: 0.19MB + 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_actionscheduler_actions: Data: 1.03MB + Index: 0.44MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 1.03MB + Index: 0.19MB + Engine InnoDB wp_automatewoo_abandoned_carts: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_automatewoo_customers: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_log_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_queue_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.09MB + Index: 0.09MB + Engine InnoDB wp_e_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gla_attribute_mapping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gla_budget_recommendations: Data: 0.20MB + Index: 0.11MB + Engine InnoDB wp_gla_merchant_issues: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gla_shipping_rates: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_gla_shipping_times: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_jckwds: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_automations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_automation_runs: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_automation_run_logs: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_automation_triggers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_automation_versions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_custom_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_dynamic_segment_filters: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_feature_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_mapping_to_external_entities: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_newsletter_links: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_newsletter_option: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_option_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_segment: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_templates: Data: 2.52MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_scheduled_tasks: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_scheduled_task_subscribers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_segments: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_sending_queues: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_settings: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_statistics_bounces: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_statistics_clicks: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_statistics_forms: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_statistics_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_statistics_opens: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_mailpoet_statistics_unsubscribes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_statistics_woocommerce_purchases: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_mailpoet_stats_notifications: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_subscribers: Data: 0.02MB + Index: 0.13MB + Engine InnoDB wp_mailpoet_subscriber_custom_field: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_subscriber_ips: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_subscriber_segment: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_subscriber_tag: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_tags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_user_agents: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_user_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 5.28MB + Index: 1.09MB + Engine InnoDB wp_postmeta: Data: 7.47MB + Index: 6.84MB + Engine InnoDB wp_posts: Data: 7.19MB + Index: 0.64MB + Engine InnoDB wp_skrill_transaction_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_snippets: Data: 0.08MB + Index: 0.03MB + 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.27MB + Index: 0.17MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.11MB + Index: 0.09MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wcrp_rental_products_rentals: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.30MB + Index: 0.58MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_warranty_products: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_pickup_locations_geodata: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_woocommerce_shipping_table_rates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_square_customers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpmailsmtp_debug_events: Data: 0.20MB + Index: 0.00MB + Engine InnoDB wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpml_mails: Data: 4.52MB + Index: 0.00MB + Engine InnoDB wp_wp_phpmyadmin_extension__errors_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yith_wcwl: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yith_wcwl_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB

Post Type Counts

attachment: 57 customize_changeset: 155 custom_css: 1 elementor_library: 1 jetpack_migration: 2 jp_img_sitemap: 8 jp_sitemap: 8 jp_sitemap_master: 8 mailpoet_page: 1 nav_menu_item: 11 page: 9 post: 1 product: 2682 product_variation: 110 revision: 203 shop_coupon: 8 shop_order: 304 shop_order_refund: 16 shop_subscription: 6 warranty_request: 1 wc_pickup_location: 1 wpcf7_contact_form: 1 wp_global_styles: 8 wp_navigation: 1

Security

Secure connection (HTTPS): ✔ Hide errors from visitors: ✔

Active Plugins (16)

Akismet Anti-Spam: by Automattic – 5.1 Code Snippets: by Code Snippets Pro – 3.4.0 Facebook for WooCommerce: by Facebook – 3.0.25 Google Listings and Ads: by WooCommerce – 2.4.10 Gutenberg: by Gutenberg Team – 16.0.0 Jetpack: by Automattic – 12.3-a.5 Loco Translate: by Tim Whitlock – 2.6.4 WooCommerce Blocks: by Automattic – 10.4.2 WooCommerce Stripe Gateway: by WooCommerce – 7.4.1 WooCommerce PayPal Payments: by WooCommerce – 2.1.0 WooCommerce Shipping & Tax: by WooCommerce – 2.2.5 WooCommerce Square: by WooCommerce – 3.8.3 WooCommerce: by Automattic – 7.8.0 WP Crontrol: by John Blackbourn & crontributors – 1.15.2 WP Mail Logging: by WP Mail Logging Team – 1.11.2 WP Mail SMTP: by WP Mail SMTP – 3.8.0

Inactive Plugins (40)

Advanced Import: by AddonsPress – 1.4.0 AutomateWoo: by WooCommerce – 5.5.20 Braintree for WooCommerce Payment Gateway: by WooCommerce – 3.0.2 Classic Editor: by WordPress Contributors – 1.6.3 Classic Widgets: by WordPress Contributors – 0.3 Contact Form 7: by Takayuki Miyoshi – 5.7.7 Crowdsignal Forms: by Automattic – 1.7.0 Crowdsignal Polls & Ratings: by Automattic Inc. – 3.0.10

Disable Admin Notices Individually: by Creative Motion info@cm-wp.com – 1.3.3 Layout Grid: by Automattic – 1.8.3 MailPoet: by MailPoet – 4.18.1 Page Optimize: by Automattic – 0.5.3 Price By Country: by HighAddons – 1.0.4 (update to version 1.0.6 is available) Price Drop Notifier for WooCommerce: by FantasticPlugins – 2.3 Rental Products: by 99w – 3.7.3 (update to version 4.3.0 is available) Site Kit by Google: by Google – 1.102.0 Skrill - WooCommerce: by Skrill – 1.0.55 Smart Product Quantity: by HighAddons – 1.0.2 (update to version 1.0.4 is available) Vimeo: by Vimeo – 1.2.1 WooCommerce Authorize.Net Gateway: by SkyVerge – 3.9.2 (update to version 3.9.3 is available) WooCommerce Delivery Slots by Iconic: by Iconic – 1.18.0 WooCommerce Eway Payment Gateway: by WooCommerce – 3.6.1 WooCommerce Give Products: by WooCommerce – 1.1.21 WooCommerce Google Analytics Integration: by WooCommerce – 1.8.2 WooCommerce iPay88 Payment Gateway: by VanboDevelops – 1.3.4 (update to version 1.4.5 is available) WooCommerce Local Pickup Plus: by SkyVerge – 2.9.12 (update to version 2.11.1 is available) WooCommerce Payfast Gateway: by WooCommerce – 1.5.4 WooCommerce Payments: by Automattic – 6.0.0 WooCommerce PDF Invoices: by Andrew Benbow – 4.16.0 (update to version 4.18.2 is available) WooCommerce Pre-Orders: by WooCommerce – 1.7.2 (update to version 2.0.2 is available) WooCommerce Products Compare: by WooCommerce – 1.1.0 (update to version 1.2.0 is available) WooCommerce Subscriptions: by WooCommerce – 5.0.1 (update to version 5.1.3 is available) WooCommerce Table Rate Shipping: by WooCommerce – 3.0.41 (update to version 3.1.1 is available) WooCommerce Warranty Requests: by WooCommerce – 1.9.34 (update to version 2.1.9 is available) WordPress.com Editing Toolkit: by Automattic – 3.68851 WPForms Lite: by WPForms – 1.8.2.1 WP phpMyAdmin: by Puvox.software – 5.2.1.02 YITH WooCommerce Compare: by YITH – 2.27.0 YITH WooCommerce Quick View: by YITH – 1.28.0 YITH WooCommerce Wishlist: by YITH – 3.22.0

Dropin Plugins (2)

advanced-cache.php: advanced-cache.php object-cache.php: Memcached

Must Use Plugins (1)

WP.com Site Helper: by –

Settings

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

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: ✔ Enforce Approved Product Download Directories: ✔ HPOS feature screen enabled: – HPOS feature enabled: – Order datastore: WC_Order_Data_Store_CPT HPOS data sync enabled: –

WC Pages

Shop base: #14 - /shop/ Cart: #15 - /cart/ Checkout: #16 - /checkout/ My account: #17 - /my-account/ Terms and conditions: #475 - /terms-and-conditions/

Theme

Name: Storefront Version: 4.1.3 (update to version 4.3.0 is available) 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: –

WooCommerce PayPal Payments

Onboarded: ✔ Shop country code: US WooCommerce currency supported: ✔ Advanced Card Processing available in country: ✔ Pay Later messaging available in country: ✔ Webhook status: – Vault enabled: ✔ Logging enabled: – Reference Transactions: ✔ Used PayPal Checkout plugin: – Tracking enabled: ✔

Square

Environment: Production Tokenization Enabled: ✔ Debug Mode: Off

Admin

Enabled Features: activity-panels analytics product-block-editor coupons customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page

Disabled Features: core-profiler minified-js new-product-management-experience product-variation-management settings async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2023-06-16 15:18:40 +08:00 Options: ✔ Notes: 105 Onboarding: completed

Action Scheduler

Complete: 1,300 Oldest: 2023-05-16 13:11:12 +0800 Newest: 2023-06-16 12:17:42 +0800

Failed: 112 Oldest: 2022-12-02 14:55:12 +0800 Newest: 2023-06-01 23:00:39 +0800

Pending: 5 Oldest: 2023-06-16 12:56:37 +0800 Newest: 2023-06-20 01:20:46 +0800

Status report information

Generated at: 2023-06-16 12:24:49 +08:00 `

Isolating the problem

thisissandip commented 1 year ago

It works on my end:

qBFHx8.png

Can you try this again with 7.8.2?

CSV:

WlCKIV.png

AndrewJDawes commented 1 year ago

Hey, @xue28 !

It looks like neither the "Sales price dates" meta boxes nor the Date sale price starts/Date sale price ends columns on the CSV importer currently support hours, minutes, or seconds.

For example, the tooltip on the "Sales price dates" meta boxes reads: The sale will start at 00:00:00 of "From" date and end at 23:59:59 of "To" date. You can only set a YYYY-MM-DD using the meta boxes - the times will be set when processing the form submission.

And the reference on what values are permitted in the CSV import columns only lists YYYY-MM-DD date values as valid: https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Import-Schema#csv-columns-and-formatting

But I think there is definitely a bug, because as the CSV import documentation says, the Date sales price ends column on the CSV importer should be "end of day".

So, the expected behavior would be that the Date sales price ends time is set to 23:59:59 (end of day).

I submitted a pull request to make the CSV importer behave the same as the meta boxes (and as advertised in the documentation): https://github.com/woocommerce/woocommerce/pull/39157

To your original example, I think would probably be nice if at some point sales dates supported dynamic times overall.

AndrewJDawes commented 1 year ago

Noting - a pull request was opened to add support for times to the product CSV importer: https://github.com/woocommerce/woocommerce/pull/39267