• Resolved siutek

    (@siutek)


    I am using the new woocommerce block layout on the checkout page. How do I set to make the discount coupons form always visible? Without having to click on the “Add a coupon” link? Previously it was enough to set the appropriate styles. Now this way does not work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @siutek,

    As I understand you wish to have the Coupon form to be displayed open by default instead of having to click to show the form. Or rather, to have the option to toggle this feature on or off. This isn’t possible in the current state of the checkout block, though, but it’s a great suggestion.

    We appreciate your suggestions and are always looking for ways to improve our products and services, and input from users like you is invaluable.

    We have a website where you can submit feature requests and upvote the ones other people submitted and you like. You can check that out?here.

    In the meantime, I think this could be achieved through a custom snippet. A quick Google Search would be a great place to start! If you’re a developer or you can hire a developer this is an option to consider. I can recommend the Woo Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the Woo Community Slack. We’re lucky to have a great community of open-source developers for Woo, and many of our developers hang out there, as well.

    Please let us know if there’s anything else we can do to help or if you have further questions.

    Have a wonderful day!
    -OP

    This would be a very helpful feature to have! I just added a feature request for it: https://woocommerce.com/feature-request/allow-the-cart-and-checkout-blocks-coupon-field-to-be-displayed-by-default/

    I found the following snippet of code on the #developer Slack channel:

     function enqueue_open_coupon_section_script() {
    // Check if we are on the checkout page
    if ( is_checkout() || is_cart() ) {
    ?>
    <script type="text/javascript">
    // using MutationObserver to detect when the coupon section is added to the DOM
    var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
    if (mutation.addedNodes && mutation.addedNodes.length > 0) {
    var couponButton = document.querySelector('.wc-block-components-totals-coupon button');
    if (couponButton && !document.querySelector('.wc-block-components-totals-coupon').classList.contains('is-open')) {
    couponButton.click();
    observer.disconnect();
    }
    }
    });
    });
    observer.observe(document.body, {
    childList: true,
    subtree: true
    });
    </script>
    <?php
    }
    }
    add_action('wp_footer', 'enqueue_open_coupon_section_script');
    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @robertstaddon,

    ?I just added a feature request for it

    The feature request you’ve submitted – allowing the cart and checkout blocks coupon field to be displayed by default – is indeed a great idea. It can definitely enhance the user experience by making the coupon application process more straightforward.

    However, in order to have it implemented, we recommend voting for the feature as the feature request with most votes, has the likelihood to be prioritized sooner.

    More details can be found here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.