I managed to get it working, here is answer:
– when importing update new stock to custom field: _custom_stock_placeholder
– update only this field: _custom_stock_placeholder
– add this code to functions.php
add_action('pmxi_saved_post', 'post_saved', 10, 1);
function post_saved($id) {
$original_stock = get_post_meta($id, '_stock', true);
$new_stock = get_post_meta($id, '_custom_stock_placeholder', true);
$combined_stock= $original_stock + $new_stock;
update_post_meta($id, '_stock', $combined_stock);
}
Related Posts:
- How to automatically apply woocommerce product title to all product images alt tags?
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- Edit tag cloud widget number
- 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?
- Woocommerce auto cancel On-Hold after X days
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- Add custom field to attachments in a specific category
- WooCommerce – Customer Order History Pagination
- The values of custom fields are not available functions.php
- How can update custom meta for all posts
- Output a WooCommerce product custom field in WooCommerce using get_post_meta()
- Use is_product_category() properly
- Changing Woocommerce flat rate every nth number of items
- Limiting woocommerce line_total decimal length
- How do I display a user’s previous orders as a select box option on a product?
- How do you add customer capability after Woocommerce purchase?
- get current product name in functions.php
- tracking number field in Woocommerce order [closed]
- Image as Sales Badge
- Passing the custom field values in the wp_get_current_user array function
- Two Different Links for Same Product – WooCommerce [closed]
- Auto-update products after they were published – Woocommerce
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Display a specific category of products in shop page and disable code for specific actions
- Woocommerce related product text
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- How can I get the values of my WordPress $wpdb query in Jquery?
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Trouble checking if custom woocommerce checkout field is empty or not
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Validation algorithm in checkout field
- My new button is in the wrong place
- Trying to retrieve post meta
- Redirect to another page using contact form 7? [closed]
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Which PHP page is the Default Posts Page
- Can’t save php string to a custom field
- How to show/hide php table rows based on the content of custom fields
- require_once() if a product in woocommerce contains a tag [closed]
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Remove item in Checkout
- How do I change this function from two returns to one string to show sku and dimensions in WooCommerce cart?
- woocommerce specific quantities for product
- How to add data to a custom field at the wp_users table?
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- How do i wrap woocomerce attribute in list?
- Removing files programmatically
- Custom Taxonomy Select Menu: Setting default option value?
- Hide a div when a custom field is empty
- Conditional On custom field plugin metabox
- Execute PHP code only with specific user role
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Woocommerce order status payment
- Dynamically added custom fields not displayed on WooCommerce email notifications
- Updating Metadata with Shortcode
- Woocommerce My acount page
- Woocommerce – Exclude variation attribute on specific variation
- Display custom field value in woocommerce variable product via jQurey
- Trying to update Woocommerce meta values
- Is it possible to update the dataset using update_post_meta
- Billing detail page doesn’t work after I’ve changed the order of the Woocommerce navigation
- PHP function for horizontal Woocommerce thumbnails and badges
- 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
- Hide payment method based on user role AND minimum cart value
- WooCommerce display price before add to cart [closed]
- Remove span tags from WooCommerce Downloads page
- Discount in the specific product title using keyword ( Woocoommerce )
- Including user data in “new user notification email”
- Woocommerce textarea format ignored
- How to auto-generate random numbers in username?
- Remove generated category and tag class names from woocommerce product & blog listings markup
- WP_Query To Display Product Of Brand On Taxonomy Page
- Woocommerce Add custom “Add to cart button” in single page with tags
- Get Billing Email from WooCommece Checkout and Pass to Fullstory JS
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- WooCommerce multiple custom fields code
- Add missing alt tag to featured images for “storefront” theme
- Woocommerce Price Text
- Display custom meta box in my template file
- How to get the rating value of each comment
- How to add margin underneath woocommerce total price amount -> productpages
- ACF Date fileds to Age Convert [closed]
- Woocommerce – Shipping tax class based on cart items not using the highest tax available
- Warning: Attempt to read property “term_id” on int – Woocommerce
- Replace the image of a product with its video in the shop page
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- Automatically change insurance quantity based on cart total [closed]
- How call WordPress shortcode inside function file
- strict custom php script on specific product category [closed]
- How to pass value to add_filter wpcf7_form_tag from another function?
- Add text below WooCommerce short description if metabox value is true
- ACF number less than comparison not working
- Woocomerce custom add to cart button edit functionality [closed]
- How to get default variation ID (woocommerce)