Answer the question
In order to leave comments, you need to log in
Writing the woocomerence plugin | price update?
I am writing a plugin to update prices and stock balance (I use Paladin ECOMM_API), in general, now I just need to add a line that will update prices (taking them from api, but I have no idea how this is done, can someone tell me? Is there any is it a special function?$item['RetailPrice']
while ( $loop->have_posts() ) : $loop->the_post();
$product_id = get_the_ID();
update_post_meta($product_id, '_stock', 0);
update_post_meta($product_id, '_stock_status', 'outofstock');
endwhile;
// Set Stocks
foreach($res as $item) {
if($item['StockOnHand'] > 0.0 || $item['StockOnHand'] > 0) {
$product_id = wc_get_product_id_by_sku($item['MfgPartNumber ']);
update_post_meta($product_id, '_stock', $item['StockOnHand']);
update_post_meta($product_id, '_stock_status', 'instock');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question