This topic has 3 replies, 2 voices, and was last updated 1 days, 7 hours ago ago by tony83
Hello Support Team,
I am experiencing issues with the Sales Booster add-ons, specifically with the *Quantity Discount* feature and the *Progress Bar* in the cart. Below are the details of the problems:
1. Quantity Discount Bug
I have set up quantity discounts with these intervals:
– From 2 to 4: Discount applied
– From 5 to 7: Different discount applied
Here is the issue:
– When I add a product to the cart (quantity 1), everything works fine.
– If I increase the quantity, the discounts are applied correctly as expected.
– However, when I decrease the quantity back to 1, the cart still displays the discount applied for quantity 2 instead of reverting to the original price.
– The correct price is only displayed after refreshing the page manually (F5).
I attempted the following troubleshooting steps:
To confirm the issue, I tested modifying the discount intervals. For example:
When changing the interval from 2 to 4 to 3 to 4, the issue persists:
– At quantity 2, the discounted price for quantity 3 remains applied.
– At quantity 1, the price reverts only after a refresh.
This behavior suggests the discount is cached or saved and does not update properly without a page refresh.
To debug this issue, I added the following code to the functions.php file of the child theme to log the cart values:
php
add_action( 'woocommerce_before_calculate_totals', 'debug_calculate_totals_execution', 20 );
function debug_calculate_totals_execution( $cart ) {
error_log( 'woocommerce_before_calculate_totals triggered' );
foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
error_log( 'Product ID: ' . $cart_item['product_id'] );
error_log( 'Quantity: ' . $cart_item['quantity'] );
error_log( 'Current Price: ' . $cart_item['data']->get_price() );
}
}
From my logs, when decreasing the quantity to 1, the cart still retains the discounted price instead of reverting to the original price. Here’s an example log:
`
[24-Jan-2025 16:28:47 UTC] Product ID: 2857
[24-Jan-2025 16:28:47 UTC] Quantity: 2
[24-Jan-2025 16:28:47 UTC] Price: 13.72
[24-Jan-2025 16:28:50 UTC] Product ID: 2857
[24-Jan-2025 16:28:50 UTC] Quantity: 1
[24-Jan-2025 16:28:50 UTC] Price: 14
`
However, the cart still shows the discounted price of 13.72
.
Then, I printed all the variables within the cart using the following code:
add_action( 'woocommerce_cart_totals_before_order_total', 'debug_cart_totals', 20 );
function debug_cart_totals() {
echo '<pre>';
print_r( WC()->cart->get_cart() );
echo '</pre>';
}
The output shows that some variables still retain the discounted price (13.72) until the page is refreshed.
The output is in file attached with name “error1”
2. Progress Bar Issue
The progress bar for free shipping in the cart has inconsistent behavior:
– Sometimes it updates correctly when the cart quantity changes.
– Other times, it freezes or displays incorrect information (e.g., showing “not eligible for free shipping” even when the threshold is met).
I found the following error in the debug log:
`
[24-Jan-2025 16:28:47 UTC] PHP Warning: A non-numeric value encountered in /home/parafarm/public_html/wp-content/themes/xstore/framework/features/woocommerce/cart-checkout.php on line 821
`
Critical Impact
These issues confuse customers as they:
1. See a discounted price that doesn’t match the checkout price.
2. Receive misleading progress bar messages.
Since we are planning to launch the site next week, I kindly ask for your urgent assistance to resolve these issues.
Thank you in advance for your support!
Best regards,
Antonio
Dear @tony83,
We kindly recommend disabling all third-party plugins that are not included with XStore. You can find the list of included plugins here: (https://www.8theme.com/documentation/xstore/plugins/included-plugins/). Once you have done this, please clear your browser’s cache and check if the issue persists. It is possible that one of the additional plugins may be causing the problem.
If the issue continues, we suggest switching to the Parent Theme if you are currently using the Child Theme on your site. After clearing the cache, please test again. Additionally, we recommend performing the same test using the default WooCommerce theme, Storefront. The issue might be related to custom code within your Child Theme.
Please let us know the results of these tests so we can assist you further.
Best regards,
The 8Theme Team
I tried everything you suggested, but it didn’t work. So, in the cart builder of the XStore theme, I replaced the default XStore cart widget with the classic WooCommerce widget, and it works (as you can see from the attached image).
Does this mean it’s a bug in the default XStore cart widget? How can I fix it?
You must be logged in to reply to this topic.Log in/Sign up