Smart Coupons provide a powerful, “all-in-one” solution for gift cards, store credits, discount coupons, and vouchers extending the core functionality of WooCommerce coupons.
This doc explains how you can mark gift card order status from processing to completed automatically and also what to do if you want to keep the order status as processing.
Smart Coupons autocompletes gift card order
↑ Back to topSmart Coupons plugin allows you to create and sell store credits / gift cards (as products) in three ways:
Now when customers purchase any of these products, the store credits / gift cards will be auto-generated & sent to the customers via email. As no shipping is required here, by default, the order statuses of these orders are marked as Processing.
However, if you are using Smart Coupons version 6.7.0 or later, the gift card orders will be automatically marked as Completed, by default.
There’s no setting or configuration required.
Note – Here are some cases wherein the orders will be marked as Completed or Processing by Smart Coupons:
- If the order contains all virtual products and all are store credit / gift cards, then the order will be marked as Completed.
- If the order does not contain a store credit / gift card product, then it will be marked as Processing irrespective of whether that product is virtual or not.
- If the order contains any one product that is not virtual, then the order will be marked as Processing.
The above-mentioned cases consider that the payment is completed for the respective orders. If the payment is not completed in the above-mentioned cases then the order status will be handled by WooCommerce & it’ll be set as Pending or Pending payment.
How to disable autocomplete gift card order
↑ Back to topIn case you don’t want the order status to autocomplete and keep the status as Processing, the Smart Coupons plugin provides two ways to disable / stop this feature:
Using a custom code snippet (recommended)
↑ Back to topIf you’re familiar with PHP code, you can follow this approach. Add the following custom code snippet to your WordPress and WooCommerce-based website. Refer to the best practices for adding custom code snippets for more details.
/** * Make processing necessary for coupon products. * * @author StoreApps <support@storeapps.org> * * @param string $need_processing Whether need processing or not. * @param array $args Additional arguments. * @return string */ function storeapps_wc_sc_coupon_product_need_processing( $need_processing = 'no', $args = array() ) { return 'yes'; } function storeapps_handle_smart_coupons_hooks() { add_filter( 'wc_sc_coupon_product_need_processing', 'storeapps_wc_sc_coupon_product_need_processing', 99, 2 ); } add_action( 'wp_loaded', 'storeapps_handle_smart_coupons_hooks' );
Adding / updating a row in database
↑ Back to topIf you’re more familiar with adding or updating values in the database, follow these steps:
- Log in to the database that is linked with your website.
- Open table
<prefix>options
. For examplewp_options
. - Search for a row that is having
wc_sc_coupon_product_need_processing
in the columnoption_name
:- If you don’t find any record, then add a new row with
wc_sc_coupon_product_need_processing
asoption_name
andyes
asoption_value
. Rest you can keep default and save. - If you find a record, then edit the
option_value
column of that row & set the value asyes
and save.
- If you don’t find any record, then add a new row with
- That’s it.