logo
down
shadow

Drupal Commerce - How to programmatically create a fixed coupon?


Drupal Commerce - How to programmatically create a fixed coupon?

Content Index :

Drupal Commerce - How to programmatically create a fixed coupon?
Tag : drupal , By : Ian
Date : December 01 2020, 05:00 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Drupal generate commerce coupon programmatically


Tag : development , By : Jojo
Date : March 29 2020, 07:55 AM
With these it helps Ok,
I found a way to do it. I copy an existing coupon and change it.
$coupon = commerce_coupon_load_by_code("facebook_coupon");

    unset($coupon->coupon_id);
    unset($coupon->created);
    unset($coupon->changed);
    unset($coupon->data);
    unset($coupon->commerce_coupon_code);

    // Save 
    commerce_coupon_save($coupon);

    //  rules_invoke_event('facebook_coupon', $coupon);
    echo $coupon->commerce_coupon_code['und'][0]['value'];

How do I create a coupon code in spree commerce?


Tag : ruby-on-rails , By : Jenuel
Date : March 29 2020, 07:55 AM
Any of those help Take a look at the Promotions section in the Spree admin area. You can add a coupon code there:

How to load all variations and its id by using product_id programmatically using Drupal Commerce-2.x?


Tag : development , By : Richard Laksana
Date : March 29 2020, 07:55 AM
Hope this helps You need first to load Product variation entity, You need to get Product variation ids from loaded product and then extract SKU, Price, Currency Code and etc.
$parameter = \Drupal::routeMatch()->getParameter('commerce_product');
$product = \Drupal\commerce_product\Entity\Product::load((int)$parameter->id());

Add the drupal commerce products to cart without page reload programmatically


Tag : drupal , By : littlefuzz
Date : March 29 2020, 07:55 AM

How to create products programmatically in Drupal 8 commerce


Tag : drupal , By : Cenneca
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
shadow
Privacy Policy - Terms - Contact Us © scrbit.com