Home Forums WoodMart support forum Help needed with customizing WooCommerce checkout coupon layout

Help needed with customizing WooCommerce checkout coupon layout

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #656721

    asilemweb
    Participant

    Hi,

    I’m trying to reposition the coupon input field on my WooCommerce checkout page — specifically, I’ve successfully moved it below the list of products and above the order total using a custom PHP hook and some CSS. However, I’m having several display issues on both desktop and mobile views that I haven’t been able to resolve.

    Desktop version:

    – I would like the coupon input field and “Apply Coupon” button to stretch fully to match the margin of the “Your Order” section (right now it cuts short).

    – When clicking on the “Have a coupon? Click here to enter your code” message, the text jumps to the center oddly — I’d prefer it remains aligned and doesn’t shift.

    Mobile version:

    – The “Have a coupon?” sentence should stay in place but be better styled to fit the mobile layout — it shouldn’t shift above or look too disconnected. How can I “have a coupon” align left and make it in one row?
    – The “Apply coupon” button is fine in a second row, but I’d like it to stretch full width to align with the input field for better UX.

    This is code I have beed used for Custom CSS:

    .woocommerce-checkout .checkout_coupon {
    display: flex;
    gap: 10px;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    align-items: center;
    }

    .woocommerce-checkout .checkout_coupon input[type=”text”] {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    }

    .woocommerce-checkout .checkout_coupon input[type=”submit”] {
    padding: 12px 20px;
    font-size: 14px;
    border: none;
    background-color: #062a2e;
    color: white;
    cursor: pointer;
    }

    .woocommerce-checkout .checkout_coupon input[type=”submit”]:hover {
    background-color: #0c3c40;
    }

    I’ve attached screenshots for reference.
    Can you please help me adjust the layout and appearance so everything looks polished across both desktop and mobile? What code lines should I add?

    Thank you so much in advance!

    Attachments:
    You must be logged in to view attached files.
    #656789

    Hello,

    Add the below Custom CSS code to Theme Settings > Custom CSS > Custom CSS for desktop.

     .woocommerce-form-coupon-toggle {
        text-align: left !important;
        margin-bottom: 10px !important;
    } 

    Add the below Custom CSS code to Theme Settings > Custom CSS > Custom CSS for mobile:

     .woocommerce-form-coupon-toggle {
        text-align: left !important;
        margin-bottom: 10px !important;
         font-size: 12px;
    } 
     
        .woocommerce-form-coupon .form-row-first {
            width: 100%;
            margin-bottom: 5px;
        }
    
        .woocommerce-form-coupon .form-row-last {
            flex: 1 1 100%;
            width: 100%;
        }
    
        .woocommerce-form-coupon .button {
            width: 100%;
            padding: 12px; 
        }

    Best Regards

    #656849

    asilemweb
    Participant

    Hi,

    Thank you very much for your help and the provided CSS code.
    Most of the issues have now been successfully resolved.

    However, there is still one small issue remaining:
    – On the desktop version, I would like the coupon code input field and the “Apply Coupon” button to stay on the same row (as they are now), but with the input field stretched all the way to the end of the container margin of “Your Order” box.
    The size of the “Apply Coupon” button is fine, but currently the input field is cut off around the middle, which doesn’t look clean or balanced.

    Any code for that?

    Thank you once again for your support and patience.

    Attachments:
    You must be logged in to view attached files.
    #657175

    Hello,

    Please add this code to the Theme Settings > Custom CSS > Custom CSS for desktop:

    .woocommerce-checkout .checkout_coupon {
        width: 560px!important;
        
    }
    .woocommerce-form-coupon .button {
    width: 160px !important;
    }
    .woocommerce-checkout .checkout_coupon input[type="text"] {
        font-size: 20px !important;
    }

    Best Regards,

    #657388

    asilemweb
    Participant

    Thank you so much Aizaz!

    You can close this topic

    #657477

    Hello,

    You’re very welcome! I’m glad I could help. If you need anything else, feel free to reach out!

    Thanks for contacting us.
    Have a great day.

    Topic Closed.
    Best Regards,

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Help needed with customizing WooCommerce checkout coupon layout’ is closed to new replies.