Woocommerce duplica le opzioni di spedizione nel checkout
-
I have a problem with the woocommerce checkout. Specifically, if the user changes shipping options on the checkout page, it is duplicated infinitely. I attach a screenshot to help you understand the situation better
The page I need help with: [log in to see the link]
-
Hi @stefanomarzi,
From the screenshot you’ve provided, it seems there might be a JavaScript error or a conflict with your theme or plugins.
Here are a few steps to troubleshoot:
1. Try switching temporarily to a default WordPress theme, like StoreFront then make a test purchase and try changing the shipping options on checkout, to see if the problem persists. If it doesn’t, the issue might be with your current theme.
2. Deactivate all your plugins except for WooCommerce to see if the issue resolves. If it does, reactivate your plugins one by one, checking the checkout page each time to identify the conflicting plugin.
If the above steps don’t resolve your issue, please provide us with the system status report from WooCommerce > Status > Get Status Report > Copy for support so we can understand your site further.
Thank you for your understanding and cooperation.
I changed the theme to the default WordPress theme and the problem no longer occurs. Is there anything I can do to fix it?
I notice that the default theme adds the shipping selection fields outside the order summary, while in the default theme it is placed inside. Is there any hook and function that allows me to do this to see if the problem goes away?
Thank you
?I confirm that the problem is that the shipment selection field is outside the summary form.
I’m not very familiar with woocomerce hooks. Could you recommend a code that moves that field after the order summary subtotal?
Thank youHi there @stefanomarzi ??
I changed the theme to the default WordPress theme and the problem no longer occurs.
Thank you for clarifying.
I confirm that the problem is that the shipment selection field is outside the summary form.
I’m not very familiar with woocomerce hooks.
This visual hook guide of the WooCommerce Checkout page should help in that direction.
I trust that points you in the right direction, but if you have more questions, let us know.
We’re happy to help.
I use this code:
// Aggiungi la nuova funzione function custom_woocommerce_review_order_before_shipping() { if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : do_action( 'woocommerce_review_order_before_shipping' ); wc_cart_totals_shipping_html(); do_action( 'woocommerce_review_order_after_shipping' ); endif; } // Aggiungi la nuova funzione sopra il totale dell'ordine add_action( 'woocommerce_review_order_before_order_total', 'custom_woocommerce_review_order_before_shipping', 999);
But the field continues to appear outside the order summary as per the screen (I also tried using the woocommerce_review_order_before_shipping hook): https://ibb.co/86WQLfY
By using the “woocommerce_review_order_before_payment” hook, the code actually changes position but is not in the correct position (https://ibb.co/5F9ccwk)! As I would like the subtotal to be displayed immediately below.
Could it be a priority issue?
Hi there @stefanomarzi ??
From what I gather, when changing the theme to the default WordPress theme, the infinite duplication of shipping options problem no longer occurs.
The new issue is with making sure the shipping options are placed where required, for the site’s particular needs. Correct?
How about using the hook at
woocommerce_review_order_before_shipping
, instead?I hope this is helpful! Please let us know if you have any further questions about this matter, or if we misinterpret your concern in any way. We will be happy to help you further.
- This reply was modified 11 months, 1 week ago by anastas10s. Reason: typo
Exact. When the default theme is active the error does not appear and the shipping options are located between the subtotal and the total of the cart (inside the )
However, when I activate the theme I use on the site (Generate Press) the error described above appears and the shipping selection form is outside of
I then copied the review-order.php template removing the following code:
if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) :
do_action( ‘woocommerce_review_order_before_shipping’ );
wc_cart_totals_shipping_html();
do_action( ‘woocommerce_review_order_after_shipping’ );
endif;
I then created the following function that adds code to the cart page through the use of a woocommerce hook:
// Add the new function
function custom_woocommerce_review_order_before_shipping() {
if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) :
do_action( ‘woocommerce_review_order_before_shipping’ );
wc_cart_totals_shipping_html();
do_action( ‘woocommerce_review_order_after_shipping’ );
endif;
}
// Add new function above order total
add_action( ‘woocommerce_review_order_before_order_total’, ‘custom_woocommerce_review_order_before_shipping’, 999);
This code should display the shipping options above the order total, but instead it appears outside the
It seems that whatever hooks you use inside the element are ignored and the shipping form is always shown in the wrong place.
https://postimg.cc/zHfM01bg
While if I use a hook external to the html element ( ) such as woocommerce_review_order_before_payment the shipping module appears in the right position and works correctly.
https://postimg.cc/RJ3dWCJX
I would like the shipping form to display between the subtotal and the total which occurs with the default theme. I also tried changing the location of the shipping module directly in review-order.php but it is always shown outside the html element ( )
I assume there is a priority issue in the hook I use.- This reply was modified 11 months, 1 week ago by stefanomarzi.
- The topic ‘Woocommerce duplica le opzioni di spedizione nel checkout’ is closed to new replies.