coupon

Display a WooCommerce coupon input field anywhere with a shortcode

怎甘沉沦 提交于 2019-12-22 23:26:11
问题 I have a small project on what I need to insert Woocommerce coupon field into any page, but this seems complicated for me. I searched on Google about this, but don't have any resources about this. Found this codes about inserting field. Inserted into a text block this code: <div class="redeem-coupon"> <form id="ajax-coupon-redeem"> <p> <input type="text" name="coupon" id="coupon"/> <input type="submit" name="redeem-coupon" value="Redeem Offer" /> </p> <p class="result"></p> </form><!-- #ajax

Add WooCommerce coupon code automatically based on product categories

烈酒焚心 提交于 2019-12-22 17:07:33
问题 I am trying to add a coupon code automatically if the cart has products from specific categories. The price must be updated in the Total after showing the discount amount. But I cant see any changes in the total, kindly help me. My code: add_action('wc_cart_product_subtotal' , 'getsubtotalc'); function getsubtotalc ($product_subtotal, $_product, $quantity, $object) { if( is_cart() || is_checkout() ) { global $woocommerce, $product; global $total_qty; /*$coupon_code = 'drawer'; if (

Add WooCommerce coupon code automatically based on product categories

天大地大妈咪最大 提交于 2019-12-22 17:07:05
问题 I am trying to add a coupon code automatically if the cart has products from specific categories. The price must be updated in the Total after showing the discount amount. But I cant see any changes in the total, kindly help me. My code: add_action('wc_cart_product_subtotal' , 'getsubtotalc'); function getsubtotalc ($product_subtotal, $_product, $quantity, $object) { if( is_cart() || is_checkout() ) { global $woocommerce, $product; global $total_qty; /*$coupon_code = 'drawer'; if (

How WooCommerce Coupons are stored in Database?

◇◆丶佛笑我妖孽 提交于 2019-12-21 09:17:40
问题 I need to run a script to check my coupons every time I have a new register, but I can't find where the coupons from coupon generator (WooCommerce) are stored. 回答1: WooCommerce Coupon are stored in wp_posts table with post_type => 'shop_coupon' . And all the associated data are stored in wp_postmeta table. You can use this MySQL query to get all the Coupon: SELECT * FROM `wp_posts` WHERE `post_type` = 'shop_coupon' ORDER BY `ID` DESC Reference: MySQL Query to Get All Coupon SELECT p.`ID`, p.

Display coupon description woocommerce

╄→尐↘猪︶ㄣ 提交于 2019-12-19 10:53:03
问题 I am trying to display coupon description once the coupon is applied (10%) in cart page. To display Total I am using $woocommerce->cart->cart_contents_total How do I display coupon description? 回答1: As you have not mentioned where do you want to have coupon description, I have printed it just before Cart Total . If you want to have it on different place, you can modify action . You can find it from here. Code: add_action('woocommerce_before_cart_totals', 'apply_product_on_coupon'); function

Programmatically create auto generated coupon codes in Magento?

不打扰是莪最后的温柔 提交于 2019-12-18 10:57:11
问题 Based on other stackoverflow posts, I've been able to use the following code to programmatically generate individual shopping cart price rule coupons in Magento. How can I programmatically call the "Auto Generate Coupon" feature to create 100 unique coupons for each price rule I make? Thanks! $coupon = Mage::getModel('salesrule/rule'); $coupon->setName($_coupon['name']) ->setDescription('this is a description') ->setFromDate(date('Y-m-d')) ->setCouponType(2) ->setCouponCode($_coupon['code'])

Apply coupon discount via GET method in URL even if cart is empty in WooCommerce

时间秒杀一切 提交于 2019-12-13 11:34:32
问题 I have a plugin that sends an advocates referral coupon code to e-mails that they enter. When the audience receives this email I'd like to create a flow where they can click on 'SHOP NOW' in the e-mail and the coupon will be automatically added. As of now, for the link under the 'SHOP NOW' button I've entered the following: websitename.biz/cart__trashed?code=DISCOUNTCODE To handle $code I've put this in my functions.php file: add_action('woocommerce_before_cart', 'discount'); function

Auto apply coupon only one time per user based on total spent in WooCommerce

余生长醉 提交于 2019-12-12 16:33:25
问题 I would like to apply a coupon automatically based on customer total spent amount. This coupon needs to be applied only one time by customer. This is what I've tried so far but I'm getting a blank screen: add_action( 'woocommerce_before_calculate_totals', 'loyalty_order_discount', 10, 1 ); function loyalty_order_discount( $order_id ) { global $woocommerce; $coupon = 'loyaltydiscount'; $customer = new WC_Customer(get_current_user_id()); $total_spent = 30; $order = wc_get_order( $order_id );

Magento coupon discount translation

。_饼干妹妹 提交于 2019-12-12 01:34:14
问题 I like to change "Discount" to "Promotion" in cart and onepage checkout. However, I can't find any file location. I have turn on the Template Path Hints from Configuration. Can anyone help me out ? 回答1: I think you'd do that in your translation file here: app/locale/en_US/Mage_Checkout.csv Just change "Discount Codes","Discount Codes" to "Discount Codes","Promotion Codes" or whatever. But the coupon phtml is here: app/design/frontend/default/default/template/checkout/cart/coupon.phtml 来源:

Disable coupons & discounts from applying to defined Woocommerce products in cart

偶尔善良 提交于 2019-12-11 15:19:34
问题 I would like to stop any discount code being applied when purchasing a certain product (in this case a Gift Card). Other items in the cart should be unaffected and have the discount code applied to them. I know that this can be done on the individual coupon creation page, but with hundreds of coupons already made I'd like a way for this to apply automatically. All help is very appreciated! This the closest code I have found, but it relates to a plugin rather than woocommerce in general. add