Ecommerce Shopify WordPress Discussion

Allow displaying a custom coupon type in WooCommerce admin coupons list

I have added a new option in the Coupon type select field WooCommerce coupon single page. Now I want to show that option below the Coupon type column of all coupon page. The value is being saved in the database as 'discount_type' meta value. So what filter should I use and how to use. I have used the below code but it does not work. add_filter('manage_shop_coupon_posts_custom_column', 'custom_coupon_type_column_content', 10, 2); function custom_coupon_type_column_content($column, $post_id) { if ($column === 'type') { $coupon = new WC_Coupon($post_id); if ($coupon) { // Get the coupon type $coupon_type = $coupon->get_discount_type(); // Customize the output based on the coupon type switch ($coupon_type) { case 'fixed_cart': echo 'Fixed Cart Discount'; break; case 'percent': echo 'Percentage Discount'; break; case 'fixed_product': echo 'Fixed Product Discount'; break; case 'custom_option': echo 'Custom Option'; break; default: echo 'Unknown Type'; } } else { echo 'N/A'; } } }
To add a custom coupon discount type that is also displayed in admin coupons list, simply use the following code snippet: add_filter( 'woocommerce_coupon_discount_types', 'add_custom_coupon_discount_type',10, 1); function add_custom_coupon_discount_type( $discount_types ) { $discount_types['custom_option'] =__( 'Custom option', 'woocommerce' ); return $discount_types; } Code goes in functions.php file of your child theme (or in a plugin). Tested and works.

January 17, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.