coupon

Ruby on rails and coupon model

寵の児 提交于 2019-12-01 13:37:48
I have really been scratching my head on this and would greatly appreciate help. I have a store setup where people can take courses. I have a course model, order model, and coupon model. Here are the associations in the models class Course < ActiveRecord::Base belongs_to :category has_many :orders has_many :coupons end class Order < ActiveRecord::Base belongs_to :course belongs_to :user belongs_to :coupon end class Coupon < ActiveRecord::Base belongs_to :course has_many :orders end I have a very simple coupon model setup that has code and newprice columns. I want the ability for someone to be

Set a coupon description in WooCommerce

大兔子大兔子 提交于 2019-12-01 13:05:18
My site dynamically gives users coupons if they have been a member for a long enough time. When I am generating the coupon I want to assign a description to the coupon. However, I seem to be unable to assign a description by updating the post's metadata with the key description as the docs suggest I should be able to. Currently I am trying to assign the description like so: $percent = 25;//DISCOUNT PERCENTAGE $coupon_code = 'testcoupon'; //Coupon Code $discount_type = 'percent'; // Type: fixed_cart, percent, fixed_product, percent_product //ASSIGN COUPON AND DISCOUNT PERCENTAGE $coupon = array

Display coupon description woocommerce

孤人 提交于 2019-12-01 11:40:27
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? 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 apply_product_on_coupon() { global $woocommerce; if ( ! empty( $woocommerce->cart->applied_coupons ) ) { $my

Ruby on rails and coupon model

大憨熊 提交于 2019-12-01 11:14:59
问题 I have really been scratching my head on this and would greatly appreciate help. I have a store setup where people can take courses. I have a course model, order model, and coupon model. Here are the associations in the models class Course < ActiveRecord::Base belongs_to :category has_many :orders has_many :coupons end class Order < ActiveRecord::Base belongs_to :course belongs_to :user belongs_to :coupon end class Coupon < ActiveRecord::Base belongs_to :course has_many :orders end I have a

List Coupon with order details in WooCommerce

牧云@^-^@ 提交于 2019-12-01 10:59:21
I have a site with 1000 coupons. All the coupons have a usage limit of one. Im using the code provided by Raunuk Gupta to export coupons directly from the SQL database. How WooCommerce Coupons are stored in Database ? Is it possible to retrieve order meta of the user that used the coupon? I would like to include in the report the user's name, email address and possibly some other custom fields. Thank you. We generate 1000 coupons and provide it to a company ( client ). Each coupon has a usage limit of 1. The company then distribute the coupons among their members. At the end of the month, we

Auto apply a percentage or fixed cart discount based on the total in WooCommerce

╄→尐↘猪︶ㄣ 提交于 2019-12-01 10:45:32
I'm trying to set up a coupon on my client's WooCommerce site so that a percentage discount applies if the total cart is below a cap amount or a fixed amount is equal or greater than the cap amount. Let's say that the cap for the cart total is 200. If the cart total is below this cap, 10% discount is applied. But if the cart total is 200 or greater, then the fixed amount of 20 is applied as the discount. For example: My cart total is 190. Since this is less than the cap of 200, the discount amount is computed as 10%, which is 19 is applied My cart total is 210. Since this is greater than the

Set a coupon description in WooCommerce

一笑奈何 提交于 2019-12-01 09:50:41
问题 My site dynamically gives users coupons if they have been a member for a long enough time. When I am generating the coupon I want to assign a description to the coupon. However, I seem to be unable to assign a description by updating the post's metadata with the key description as the docs suggest I should be able to. Currently I am trying to assign the description like so: $percent = 25;//DISCOUNT PERCENTAGE $coupon_code = 'testcoupon'; //Coupon Code $discount_type = 'percent'; // Type:

Get coupon data from WooCommerce orders

这一生的挚爱 提交于 2019-12-01 03:57:12
问题 I have created in WooCommerce two custom coupon types: function custom_discount_type( $discount_types ) { $discount_types['cash_back_fixed'] =__( 'Cash Back fixed discount', 'woocommerce' ); $discount_types['cash_back_percentage'] =__( 'Cash Back Percentage discount', 'woocommerce' ); return $discount_types; } add_filter( 'woocommerce_coupon_discount_types', 'custom_discount_type',10, 1); I would like to get the discount type after Order status is "completed", something like : function wc_m

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

江枫思渺然 提交于 2019-11-30 20:25:49
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 discount( ) { global $woocommerce; $code= $_GET["code"]; if(!empty($code)){ if($woocommerce->cart->add

Programmatically create auto generated coupon codes in Magento?

若如初见. 提交于 2019-11-30 00:58:39
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']) ->setUsesPerCoupon(1000) ->setUsesPerCustomer(100) ->setCustomerGroupIds(array(1)) //an array of