• Resolved Image[email protected]

    (@murconmurconcom)


    Code inserted to change the wording on the shop page of woo commerce shopping cart. When go to Cart page initially, the default shopping cart text is shown. Proceed to checkout then back button to Cart page. Now the desired text “Free shipping” is shown. How make show when get to the Cart page firts time. Code snippet shown below:

    // change shipping and handling text to “Free Shipping”

    add_filter(‘gettext’, ‘translate_reply’);
    add_filter(‘ngettext’, ‘translate_reply’);

    function translate_reply($translated) {
    $translated = str_ireplace(‘Shipping and handling’, ‘Free Shipping’, $translated);
    $translated = str_ireplace(‘Shipping Options Will Be Updated During Checkout.’, ‘ ‘, $translated);
    return $translated;
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Imagepauserratgutierrez

    (@pauserratgutierrez)

    Hi @murconmurconcom

    Thanks for jumping in. The issue you’re facing isn’t directly related to our plugin, but to a specific custom code you are adding. While I’m not expert in WooCommerce, I can suggest you to:

    • See official WooCommerce docs: https://developer.woocommerce.com/docs/ and https://woocommerce.com/documentation/woocommerce/
    • From what you described, the gettext filter seems to not apply during the initial page load of the cart. You may need to check if any caching mechanisms are interfering, or the specific order in which WordPress is applying the filters during the page rendering.
    • The add_filter() function can have a priority parameter used to specify the order in which the functions associated with a particular filteer are executed. Lower numbers correspond with earlier execution. Maybe you can set a specific priority that makes it happen before. See more here: https://developer.wordpress.org/reference/functions/add_filter/
    • In addition, the correct syntax for string literals requires the user of straight single or double quotation marks. The curly quotes you are using are not valid in PHP. See an example: This code add_filter(‘gettext’, ‘translate_reply’); should be add_filter('gettext', 'translate_reply');
Viewing 1 replies (of 1 total)

The topic ‘Snippet change not visible on cart page until back button’ is closed to new replies.