• Resolved fletsch

    (@fletsch)


    Hi there

    Do you have screenshots of how the estimate shipping date is displayed on product pages when buying the pro version? Also: In the free version I can’t see the estimate shipping date on the checkout page, only on the cart page. Why is it? Because sometimes customers go directly from the cart widget to checkout. Should be visible there too. Is this possible with a short code or will you might implement it into the plugin?

    Best regards,
    Fletsch

    • This topic was modified 1 week, 3 days ago by fletsch.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author RLDD

    (@rermis)

    Hi @fletsch,

    Here is an example of how the delivery estimate is displayed on a product. It is located after the short description and before the options, quantity, and add to cart button.

    Yes, the estimate is displayed in the cart and checkout pages next to each shipping method. It will display with cart/checkout shortcodes as well as cart/checkout blocks. If the cart, checkout, or display of shipping methods are customized by other plugins or the theme, the estimate may fail to display.

    The shortcode outputs an estimate based on the selected shipping method for the order, and can be used in the customer account pages. It is not suitable for cart or checkout pages, which must use the native WooCommerce templates or blocks. The cart or checkout pages display available shipping methods during the shopping session, and the plugin attaches the estimates to each method post-render.

    Thread Starter fletsch

    (@fletsch)

    Hi and thanks a lot for the screenshot. Looks promising.

    Unfortunatelly displaying the estimate delivery date on the checkout page is not working correcctly. I’m using the basic woodmart theme. Here is what I found out:

    Delivery estimate shows correctly on the cart page (injected via wse_ship_est in wp_footer as <code class=””><style> + <code class=””>label::after), but on checkout the estimate never appears even though the shipping row HTML is identical (<code class=””>#shipping_method_0_… + <code class=””>label).

    Root cause

    Registration is done here:

    <code class=””>add_action( ‘woocommerce_init’, function() { if ( wse_is_path(‘/cart’) || wse_is_path(‘/checkout’) || … ) add_action( ‘wp_footer’, ‘wse_ship_est’ ); } );

    In <code class=””>wse_is_path():

    • For /cart, if <code class=””>is_cart() is not true yet, there is still a fallback that compares <code class=””>$_SERVER[‘REQUEST_URI’] to the cart page path (permalink path).
    • For /checkout, there is only <code class=””>is_checkout() — no URL fallback.

    woocommerce_init runs early (around <code class=””>init). On many setups <code class=””>is_checkout() is still false at that moment because the main query / template conditionals are not ready yet. So <code class=””>wse_is_path(‘/checkout’) returns false, wp_footer is never hooked, and no <code class=””><style> block is output on checkout — hence no <code class=””>::after content at all. Cart still works because of the cart URL fallback.

    Suggested fix (in the plugin)

    • Either register wse_ship_est on a later hook when conditionals are reliable, e.g. <code class=””>wp or template_redirect (and keep the same wse_is_path checks), or
    • Add a checkout URL path fallback for /checkout analogous to the cart block (compare current request path to the checkout page permalink path), or
    • Replace the early <code class=””>is_checkout() check with something that doesn’t depend on the main query that early.

    Workaround (for site owners until a release)

    Add to functions.php in the child theme:

    add_action(

    'wp',

    function () {

    if ( ! function_exists( 'wse_ship_est' ) || is_admin() ) {

    return;

    }

    if ( has_action( 'wp_footer', 'wse_ship_est' ) ) {

    return;

    }

    if ( function_exists( 'is_checkout' ) && is_checkout() ) {

    add_action( 'wp_footer', 'wse_ship_est', 10 );

    }

    },

    20

    );




    Plugin Author RLDD

    (@rermis)

    Thank you, that is very helpful. I will try to include this fix or similar in the next release, likely this week. I will let you know when it is ready so you can verify it resolves the issue.

    Plugin Author RLDD

    (@rermis)

    Hi @fletsch,

    Version 2.1.15 has been released that improves checkout page ID & fallback logic. Please let me know if this resolves your issue.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.