I haven’t applied any discounts like that before, but have done it with ‘fees’ a lot.
Adding a fee is quite easy:
function custom_wc_add_fee() {
WC()->cart->add_fee( 'Fee', -10 );
}
add_action( 'woocommerce_cart_calculate_fees','custom_wc_add_fee' );
(or if you want a plugin solution, I created this plugin: https://aceplugins.com/plugin/woocommerce-advanced-fees/)
Related Posts:
- woocommerce add a new bulk action in the bulk actions dropdown in the orders list
- How to implement bulk actions in my plugin?
- WooCommerce get Shipping Class of product from either the product id or the order after order is completed
- How to iterate through custom posts and add the title to an array
- product-attribute-slug-is-too-long-28-characters-max
- get all products of one category
- How can I hook into existing WordPress Bulk actions?
- Woocommerce add custom button to backend order table
- Plugin vs Settings load order (woocommerce dependency)
- How do I hook a custom discount to change a WC_Order price total on WooCommerce?
- Add multiple shipping rates from add_rate function with custom ID
- set_sale_price in WooCommerce [closed]
- Woocommerce – Hide a Column in Cart Table
- Print value of an array or variable in a payment plugin
- How to get orders with used coupon in WooCommerce
- How to update total price of completed order in woocommerce? [closed]
- Plugin development: get_post_meta is not working [closed]
- $wpdb -> Batch insert from XML File?
- How do I change the initial quantity of a product in woocommerce?
- Order properties should not be accessed directly
- How to check if Woocommerce Order number equals to post ID?
- How do I add custom column to woocommerce cart?
- How plugins_loaded works?
- how to make custom bulk actions for a WP_List_Table (core class)
- WooCommerce Conditional Tag inside plugin
- Custom attribute type not displaying terms in edit product – WooCommerce
- WooCommerce registration password field not displaying
- Show special field when correct shipping is chosen
- Custom Plugin Options Won’t Update
- Hide one specific woocoomerce product
- Woocommerce – Provide Associated Category Link for Product List Plugin [closed]
- get_shipping_methods() return empty rate
- Remove Products From Category
- Downloading File via headers doesnt work
- want to show CMB2 metabox on woocommerce product data tab
- wp_schedule_single_event is set correctly but sometimes not fired
- Dynamic page generation upon purchase of a product
- Customise Grouped Product display in Woocommerce with custom column
- Change reminder email date to 14 days before
- Make a php array load faster
- How to make every image title equal to alt text(wordpress/woocommerce)?
- Create Woocommerce product without creating api credentials
- Pass Values in URL on WooCommerce Product Page
- Woocommerce place order update shipping price
- Add custom product data using javascript when add to cart button is clicked
- product-attribute-slug-is-too-long-28-characters-max
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- “add to cart” links css class “ajax_add_to_cart” doesn’t show in woocommerce in widget sidebar
- Securing custom rest API endpoints with public access from PWA
- How do I add filter with woocommerce categories?
- WooCommerce – Stop assigning order numbers
- Adding customs fields on each product on the cart
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- Override woocommerce loop-start.php from theme using plugin?
- Getting products information, in woocommerce based on products ID
- How to direct WordPress to load custom template for custom post type
- PHPUnit Testing and woocommerce Constant
- Redirect WooCommerce checkout to cart
- WC REST API Error Handling
- Pre-populated WooCommerce checkout fields: dropdown fields issue
- Woocommerce Product finder feature on home page
- want to confirm popup with “Yes” and “No” button when user click on add to cart
- How to remove the WooCommerce Product->Category thumbnail from admin [closed]
- Woocommerce Single Product Tabs Got Duplicate
- Woocommerce product not appearing in category list page when created programatically [closed]
- woocommerce wc_get_product is not fetching all the product of particular category
- Override WooCommerce files from plugin
- How to trigger WooCommerce user profile edit change?
- Override theme’s WooCommerce file
- WC_Geolocation not found inside plugin
- WordPress Reset password Strength set to medium
- How to use functions from Woocommerce documentation?
- external Integration with wordpress timeout error
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- Handle changed Woocommerce function
- Making Woocommerce optimized for more than 500k products
- Woocommerce Custom Checkout
- Woo-commerce: Adding additional page sections using a child theme
- WP: adding Javascript to specific woo commerce pages
- Declaring a new woo commerce product type i get this error
- woocommerce single product page hook not working
- How to remove city field from order in dashboard?
- How to only Load scripts on variable products page
- How to design WooCommerce-like admin tabs for plugin settings page?
- Woocommerce: block user removing cart item
- how do I find out if a placed order was deleted or trashed? [closed]
- What is the meta_query key name for the woo product average rating? [closed]
- get the queried_object of an url
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Return custom product in ajax call loop
- WooCommerce adds a newline symbol (\n) between email recipients
- Allow HTML in product attributes and variation for WooCommerce
- How do I add multiple custom menu Woo-commerce my account page?
- High-Performance Order Storage conflict action `manage_shop_order_posts_custom_column`
- I want to redirect user to an amazon product page from my wordpress website when they add product to there cart [closed]
- Custom fields in the billing address section woocommerce
- how to works woocommerce cart hash
- Add File field in WooCommerce Box office plugin
- Woocommerce Payment Plugin with Mycred being the payment processor
- Sticky bar with filter button and product count