Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to check if coupons are valid or not magento 2

//normaly there should be only one rule that gets here since you can apply only one coupon code
$quote->setCouponCode('YOUR_COUPON')->collectTotals()->save(); 
$quoteCouponCode = $quote->getCouponCode();//get the applied coupon code from the quote
if ($quoteCouponCode){
  //$rule is valid and $rule->getCode() is a valid coupon code
}
//remove the coupon code from the quote if you want
$quote->setCouponCode('')->collectTotals()->save(); 
Comment

PREVIOUS NEXT
Code Example
Php :: Allow mass assignment in Laravel 
Php :: bar chart in js,php prt 1 
Php :: laravel tricks and tips 
Php :: 500 Internal Server Error mamp rest api PDO 
Php :: mysql.service: Start request repeated too quickly 
Php :: Never return type - PHP 8.1 
Php :: laravel-filemanager not working 
Php :: WordPress Plugin Code Definition 
Php :: imagelib thourgh class in codeigniter 
Php :: Wonder Gallery WordPress plugin php code to display a gallery 
Php :: eloquentdatatable add column 
Php :: laravel jobs cache file picking old job file 
Php :: session flash data (old input) 
Php :: check which device is used to open webpage php 
Php :: faire un fichier zip en php 
Php :: how to save snap in webcap in php codeigniter 
Php :: import csv in laravel 
Php :: how to find number between different ranges in php 
Php :: cashier mollie 
Php :: wordpress get_permalink not working 
Php :: wordpress acf image array 
Php :: Add custom column at custom posts list 
Php :: get auth guard user laravel 
Php :: php browser cache clear 
Php :: How to get only content-length with CURL PHP? 
Php :: filter using meta_query 
Php :: form alter drupal 9 language code 
Php :: how to use cornjob on live server in laravel 
Php :: codeigniter round off function 
Php :: overwrite existing key value pair php 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =