add_action( 'woocommerce_before_calculate_totals', 'change_subscription_signup_fee', 1000, 1 );
function change_subscription_signup_fee( $cart ) {
if (is_admin() && !defined('DOING_AJAX'))
return;
if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )
return;
// Loop through cart items
foreach ( $cart->get_cart() as $cart_item ) {
// Check that product custom cart item data "alredy_have_number" exist and is true
if( isset($cart_item['alredy_have_number']) && $cart_item['alredy_have_number'] ) {
// Check if subscription products
if ( in_array( $cart_item['data']->get_type(), ['subscription', 'subscription_variation']) ) {
// Change subscription Sign up fee
$cart_item['data']->update_meta_data('_subscription_sign_up_fee', 0.90);
}
}
}
}
Related Posts:
- How to add product in woocommerce with php code [closed]
- Edit tag cloud widget number
- How to add date range in woocommerce with code
- Creating custom Woocommerce attribute taxonomies from a plugin
- get product attributes for current product and store it in a variable
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to get the original price of the product in woocommerce?
- How to Remove a Filter from the Admin List Table?
- Woocommerce, recognize the loop of related products
- Remove commas from WooCommerce checkout addresses fields
- WooCommerce Link to Product Category
- Output a WooCommerce product custom field in WooCommerce using get_post_meta()
- Append a term to WooCommerce product existing product category terms
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- Writing scripts using WordPress / WooCommerce classes?
- How to make custom total price reactive in navigation
- Inject PHP code into “sidebar-content” – code before my WooCommerce sidebar widget?
- Change description on specific WooCommerce product status change
- Add the Name of Products Ordered to Admin New Order Email WooCommerce
- Woocommerce – Filter Variable Products by Variation Attributes and Variations Regular Price
- How to add a second ‘place order’ button in WooCommerce [closed]
- WooCommerce – Reset quantity input field when variation changes
- get current product name in functions.php
- Custom Text in WooCommerce Order Processing Email Based on Products
- Get WooCommerce product details and transfer them to a custom DB table
- Automatically remove a canceled order in Woocommerce
- Woocommerce product variation backorder
- Status 400 for AJAX POST Request with admin-ajax.php
- WooCommerce Webhooks not firing because of error in wp-includes/meta.php
- WooCommerce: How can I get orders with a custom ID in order meta data object?
- Sum the total amount of a specific product purchased per user and display in table
- Add to cart function not working for first product when cart is empty [closed]
- Woocommerce : Can’t get product info in loop
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Woocommerce change prices for a certain country [closed]
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Single Quotes in .php file doesn’t load website
- Remove item in Checkout
- How to relocate paypal button gateway on checkout page in woocommerce
- Woocommerce – get_items() returns empty array
- Woocommerce Product_cat for current category page
- Include js script ONLY on woocommerce product category pages? [closed]
- WP_Query multiple post results
- Convert Featured products loop into Recent products loop?
- Woocommerce order status payment
- Dynamically added custom fields not displayed on WooCommerce email notifications
- How can I enter on the Thank you page in woocommerce the discount code I assigned to the product category?
- Woocommerce append shipping method form
- Payment field disappears on custom Paypal plugin
- Creating a brand attribute as a variable
- How do I set a hidden field to a value?
- How to remove Login from in my account page
- I am having errors with checkout on wordpress
- How to access specific product id on other pages/posts?
- How do I check if a product is in two categories?
- php code for outputting a custom page in my account
- Hide specific shipping methode depending on day and time of day
- Programmatically add a product to the cart and set price to zero when buying from certain category
- I want to show cart items number if any or nothing, simple CART text
- Adding custom field to product category and show it to shop/category shop page
- How to retrieve quantity input field by id in woocommerce
- Get only relevant sub-category of category “Genre” that applies to current product only
- Using zip code to display custom data in Admin Order Details
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Including user data in “new user notification email”
- How to empty price of simple and variable product when product changed into out off stock
- How do I remove an action hook inside a class that is called by another class?
- Add Shortcode to ::before class
- i want add conditional for add category in wordpress
- WooCommerce get products based on the taxonomy
- Woocommerce Add custom “Add to cart button” in single page with tags
- Woocommerce remove menu item on myaccount dashboard
- How to echo a PHP code into WooCommerce variation product?
- Get Billing Email from WooCommece Checkout and Pass to Fullstory JS
- Woocommerce custom attributes list help
- append data to mysql table via submit button coded in php – not working
- random woocommerce categories are not showing when count enabled?
- PHP – Woocommerce 3.2 Add variable shipping insurance with multiple “else if ” conditions
- Global filter not working
- how to display woocomerce description of each category in wordpress? [closed]
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- WooCommerce – Add product category below product price [closed]
- woocommerce plugin bugs
- Adding my own custom template page but got white page
- Woocommerce Price Text
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- How to add margin underneath woocommerce total price amount -> productpages
- wc_add_notice not working on cart page
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Woocommerce – Shipping tax class based on cart items not using the highest tax available
- How do I update product shipping using PHP in WooCommerce?
- How can I edit the WooCommerce Mini DropDown Cart to read as follows
- Show button in header when product custom field is not empty
- WordPress 6.1.1 UTF8 Slug Limit Increase
- Woocommerce Convert existing order to the cart
- How to change shipping method title based on cart amount?
- Woocommerce product variations getting created without attribute values selected
- How to add SKU and remove product title from WooCommerce url?
- Product Search in search.php
- using custom pages for myaccount in woocommerce