WordPress.org

Support

Support » Plugins and Hacks » checkout coupons not working

checkout coupons not working

  • Hello,

    I am having trouble with woocommerce coupons on the checkout page. On the cart page it is fine and when I enter the coupon I get the discount applied, but on the checkout page when I click on “Have a coupon? Click here to enter your code” nothing happens or it just gets linked to #.

    so the url is http://www.ylsandbox.com/checkout/ and when I click on the coupon button I get http://www.ylsandbox.com/checkout/#

    you can see the image on:
    Image

    Also the code for /wp-content/plugins/woocommerce/templates/checkout file form-coupon.php looks like this:

    <?php
    /**
     * Checkout coupon form
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     1.6.4
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    global $woocommerce;
    
    if ( ! $woocommerce->cart->coupons_enabled() )
    	return;
    
    $info_message = apply_filters('woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ));
    ?>
    
    <p class="woocommerce-info"><?php echo $info_message; ?> <a href="#" class="showcoupon"><?php _e( 'Click here to enter your code', 'woocommerce' ); ?></a></p>
    
    <form class="checkout_coupon" method="post" style="display:none">
    
    	<p class="form-row form-row-first">
    		<input type="text" name="coupon_code" class="input-text" placeholder="<?php _e( 'Coupon code', 'woocommerce' ); ?>" id="coupon_code" value="" />
    	</p>
    
    	<p class="form-row form-row-last">
    		<input type="submit" class="button" name="apply_coupon" value="<?php _e( 'Apply Coupon', 'woocommerce' ); ?>" />
    	</p>
    
    	<div class="clear"></div>
    </form>

    Please help I would like to make it work on the checkout page as well, instead of just redirecting to #.

    Thank you!

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I Know this will not help you, but you are not alon I have the exact same problem.

    Default form-coupon.php template looks like this:

    <?php
    /**
     * Checkout coupon form
     *
     * @author      WooThemes
     * @package     WooCommerce/Templates
     * @version     1.6.4
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    global $woocommerce;
    
    if ( ! WC()->cart->coupons_enabled() )
        return;
    
    $info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) );
    $info_message .= ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>';
    wc_print_notice( $info_message, 'notice' );
    ?>
    
    <form class="checkout_coupon" method="post" style="display:none">
    
        <p class="form-row form-row-first">
            <input type="text" name="coupon_code" class="input-text" placeholder="<?php _e( 'Coupon code', 'woocommerce' ); ?>" id="coupon_code" value="" />
        </p>
    
        <p class="form-row form-row-last">
            <input type="submit" class="button" name="apply_coupon" value="<?php _e( 'Apply Coupon', 'woocommerce' ); ?>" />
        </p>
    
        <div class="clear"></div>
    </form>

    Try first renaming/deleting your custom form-coupon.php to see if the default one works, if so you know it’s template issue so use the default one with appropriate changes…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘checkout coupons not working’ is closed to new replies.