coupon

Exclude variations with 2 specific attribute terms from coupon usage in Woocommerce

风流意气都作罢 提交于 2019-12-24 11:16:26
问题 I need to prevent coupons being used if customer have any specific product variations in their cart with following attribute terms: attribute_pa_style => swirly attribute_pa_style => circle I've looked through the Woocommerce scripts that apply to restricting specific products and specific categories, but can't figure it out with regard to attributes and all coupons. Any help is appreciated. 回答1: This can be done using woocommerce_coupon_is_valid filter hook this way: add_filter( 'woocommerce

Find the name and email address of non-members who used coupon code in Magento

淺唱寂寞╮ 提交于 2019-12-24 11:11:45
问题 We would like to be able to pull the name and email address of customers who purchased items as a guest. Has anyone had any luck in doing so? I've seen a few posts of how to pull the names of customers who have used the coupon code, but nothing about non-customers! Thank you guys very much for your help! -Jeff 回答1: This should work: $orderCollection = Mage::getModel('sales/order')->getCollection() ->addAttributeToSelect('customer_firstname') ->addAttributeToSelect('customer_lastname') -

Exclude variations with 2 specific attribute terms from coupon usage in Woocommerce

社会主义新天地 提交于 2019-12-24 11:11:29
问题 I need to prevent coupons being used if customer have any specific product variations in their cart with following attribute terms: attribute_pa_style => swirly attribute_pa_style => circle I've looked through the Woocommerce scripts that apply to restricting specific products and specific categories, but can't figure it out with regard to attributes and all coupons. Any help is appreciated. 回答1: This can be done using woocommerce_coupon_is_valid filter hook this way: add_filter( 'woocommerce

If WooCommerce Cart items are on backorder do not apply coupon

∥☆過路亽.° 提交于 2019-12-24 09:54:03
问题 So far this is what I've got: add_filter('woocommerce_coupon_is_valid','coupon_always_valid',99,2); function coupon_always_valid($valid, $coupon){ global $woocommerce; $valid = true; foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) { // if($values['data']->backorders_allowed()){ //check if backorders are allowed on this product // get the stock quantity - returns the available amount number $stock_info = $values['data']->get_stock_quantity(); if($stock_info < 1){ $vaild

APNS server responds with status 8-invalid-token, but devices are being registered properly

坚强是说给别人听的谎言 提交于 2019-12-24 08:30:26
问题 I am implementing passbook funcationality for my iOS app. I am using php as server side language to generate pass and distribute to devices. Passes are being successfully installed on the device and I am also able to update pass manually using pull to referesh. When I try to update pass automatically from server side I get the response status 8-invalid-token with message "Identifier is the rowID(index) in the database that caused the problem. Apple will disconnect you.....". I don't get why

Mandatory Coupon code for specific Woocommerce product category items

百般思念 提交于 2019-12-24 06:32:22
问题 In Woocommerce, I'm trying to make a Coupon Code mandatory for all Products from a specific Category. The following code (placed in functions.php) works well, but makes Coupon Codes mandatory for all Products regardless of the product category: add_action('woocommerce_check_cart_items', 'make_coupon_code'); function make_coupon_code() { global $woocommerce; if(is_cart() || is_checkout()){ $my_coupon = $woocommerce->cart->applied_coupons; echo $woocommerce->cart->get_applied_coupons; if(empty(

Fill out custom field with used coupon code WooCommerce

不羁岁月 提交于 2019-12-23 05:18:07
问题 Right now I'm working with a mailchimp plugin that needs a custom field for validating/segmenting. For this segment I want to check what kind of coupon is used. So I scavenged the following code that should fill my custom field with the used coupons: add_action( 'woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' ); function my_custom_checkout_field_update_order_meta( $order_id ) { if ( empty( $_POST['my_field_name'] ) ) { $coupons = $order->get_used_coupons

Progressive fixed Coupon Discount based on specific product quantity in Woocommerce

不羁的心 提交于 2019-12-23 03:40:33
问题 I have one little problem that dont know how to fix myself. I want to use this logic into my Woocommerce store just for one product. I have use link like this to autmatically apply coupon code and add to cart: https://testsite.com/checkout/?add-to-cart=Product_ID&quantity=1&coupon=Coupon_Code and this seems to work, when quantity is 1. But i want discount (30%) that is automatically placed when click on direct link from before, to make dynamic, for ex: Increase quantity to 2 in cart page, and

How to generate woocommerce coupon code dynamically using programming code

▼魔方 西西 提交于 2019-12-23 02:34:16
问题 I want to generate woocommerce coupon code dynamically. My requirements is that after complete the order automatically generate one coupon code in admin side woocommerce coupon code list for particular product. So any one know my above requirement solutions then please help me. Thanks, Ketan. 回答1: You can used woocommerce_order_status_completed action hook for order complete. and create post with post type shop_coupon for coupan using wp_insert_post . check below code function action

How to apply an automatic discount in WooCommerce based on cart total?

家住魔仙堡 提交于 2019-12-23 01:28:24
问题 Referring to this question How do I programmatically apply a coupon in Woocommerce? I'm looking for something very similar to the final solution in the first post, but I'd like the coupon to be applied if the subtotal is > 99 euros. How do you think I can modify the code? And since I'm a newbie... where do I have to paste the whole code? Thanks a lot 回答1: Something like this could be done: add_action('woocommerce_before_checkout_process','add_discount_at_checkout'); function add_discount_at