1. Home
  2. ReHub Theme
  3. Shop (woocommerce) options
  4. How to use woocommerce only for printable coupons of local shops

How to use woocommerce only for printable coupons of local shops

You can use Rehub and woocommerce also for printable coupons. For example, you want to deal with local shops and promote their coupons or printable flyers. First of all, enable printable script in Theme option – shop settings – Enable print coupon function?

Then, create Product and make it as External type.

By default, woocommerce requires to have external links for coupons, but you can disable this with next code

add_action('woocommerce_external_add_to_cart', 'rh_external_coup_woo');
function rh_external_coup_woo(){
    if ( ! $product->add_to_cart_url() ) {
        wc_get_template( 'single-product/add-to-cart/external.php', array(
            'product_url' => $product->add_to_cart_url(),
            'button_text' => $product->single_add_to_cart_text(),
        ) );
    }
}

in functions.php

How to customize your theme

After this, you can leave url field for external product empty, so, your product will show only coupon. Important thing! Your coupon must be opened (not hidden), also, you can assign any link to image which you want to include. Check example