AHOiREKLAMA
Forum Replies Created
-
Resolved.
I mistakenly thought that
update_post_meta($product_id, 'meta_key', 'meta_value')
in combination with$product->save()
would update all necessary data (wp_postmeta, WC product lookup tables, transients), but apparently it does not.When using the
$product->set_
methods with combination with$product->save()
, it works well.- This reply was modified 3 years, 11 months ago by AHOiREKLAMA. Reason: Updated information
Forum: Plugins
In reply to: [WooCommerce] Some orders showing only Parent SKU’s – not variation skusToday I’ve experienced the same issue.
Parent product has SKU of ‘1234’.
It has 10 variations, all of them enabled and in stock, their SKU is in this format:
‘1234-COLOR’ (each has different color).The RED variation got ordered but the order only shows parent ‘1234’ SKU without variation specified. Also, none variation had stock value decreased, this product is completely missing from the order notes log. I’ve checked the wp_woocommerce_order_itemmeta table and the variation ID for that line item shows ‘0’.
If it wasn’t for SmartLook recording I wouldn’t be able to know which variation was purchased.
Immediately after that I did a test order with the same products and everything works fine, I can see the red variation in orde details, stock value got decreased successfully, so it seems really random. Happened for the first time.
Any updates?
Not much to say, as I said I am only updating product’s stock and prices using update_post_meta and then saving it with the save() method.
// Prices update_post_meta($product_id, '_price', (float)$price); update_post_meta($product_id, '_regular_price', (float)$regular_price); if(!empty($sale_price)) { update_post_meta($product_id, '_sale_price', (float)$sale_price); } else { delete_post_meta($product_id, '_sale_price'); } // Stock update_post_meta($product_id, '_stock', $stock_qty); if ($stock_qty > 0) { update_post_meta($product_id, '_stock_status', 'instock'); } else { update_post_meta($product_id, '_stock_status', 'outofstock'); } // Save product $product->save();
No hooks, it is a custom PHP file triggered with CRON that gets product IDs from CSV and then processes each product in a loop.
- This reply was modified 4 years ago by AHOiREKLAMA.
Worked perfectly. I’ve also clicked the “Clean CSS/JS Optimizer” option.
Thank you.
That thread (and the link mentioned in that thread) explains why those records are being created in the database (thus increasing in size). As I said, I understand that.
Once again, I am not using LSCache’s CSS or JS optimization settings at all anymore, I just would like to know whether it is safe to empty that table or not, since I would expect it to be purged automatically after disabling those optimize settings.
Hello, I am importing images that already exist in Media library, so the “Keep images currently in Media Library” option is not even active – so that shouldn’t be any problem for me.
However, I don’t see any “Skip posts if their data in your file has not changed” option in Import Settings.
I have “Update existing produkty with changed data in your file” with “Choose which data to update” option selected, but nothing about skipping.
Thank you.
- This reply was modified 4 years, 1 month ago by AHOiREKLAMA.
Forum: Plugins
In reply to: [WooCommerce] Some “visible” products are not visible in catalogHi @abwaita,
yes, I’ve just tried it. Same results on Twenty Twenty. Somehow (randomly) couple of products are completely missing from both search and catalog, until I re-save them as described in my original post.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] I can’t search by a 3 digit numeric stringI’m using the CiyaShop theme which apparently uses it’s own search engine, so that’s probably what is conflicting with Relevanssi.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] I can’t search by a 3 digit numeric stringYes, it does work in Dashboard > Admin search. I get two products matching the “996” query just fine.
On the front end however I get 6 unreated products, that seem random (I noticed they don’t even contain “996” in the content, nor in the custom fields I’ve specified). This is the query from the Query Monitor: https://prnt.sc/wnbqib
Hi Thomas,
I was referring to the classic GTM Preview tool.
Sure, I can sand you the site domain and shared preview link, is there a way to send you this privately and not on public forum?
Thank you
Forum: Plugins
In reply to: [WooCommerce] Wrong attributes order when sorted numerically@robertghetau @wpmuguru Sorry, I haven’t noticed you replied.
Yes, I’ve set the attribute order directly in Products > Attributes. I’ve set the ordering of the ‘size’ attribute to “Name (numeric)”.
I know it can be done manually on product level, but as I said, I have thousands of products and hundrends of sizes defined in the store, so this is probably out of the question.
Forum: Plugins
In reply to: [Import any XML, CSV or Excel File to WordPress] Cron import is too slow@probadown Then you could use your own function for that. Add this function to the WP All Import’s Function editor:
function wc_get_product_id_by_modified_sku($sku) { $sku = 'AB' . $sku; return wc_get_product_id_by_sku($sku); }
And then in your import field, use this call:
[wc_get_product_id_by_modified_sku({sku[1]})]
Forum: Plugins
In reply to: [Import any XML, CSV or Excel File to WordPress] Cron import is too slowI am not sure what are you trying to achieve. In regards of speed, disabling do_action calls helped me a lot, the cron import time went from 12 hours to 3-4.
So you need to access product ID during import, based on your modified SKU? I am not sure how is it speed related (considering it is being posted to this topic). As far as I know wc_get_product_id_by_sku is a pretty straightforward function and should’t affect performance that much.
If you just need to call that function with your modified SKU, try this:
[wc_get_product_id_by_sku("AB".{sku[1]})]
(I’m not sure whether you can use string combine operator (dot) there, but give it a shot)
Forum: Plugins
In reply to: [Import any XML, CSV or Excel File to WordPress] Cron import is too slowUpdate: I overlooked the “Disable do_action calls” option. I will try that (maybe along with increasing the script running time) and I’ll let you know.
Oh god. It works, mea culpa.
Those settings were all right. I just messed up the unique identifier and ended up with creating new products after every run, while I was checking for those custom fields in the original products. I didn’t notice.