Is there any way to update all of my products SKU? I have a space in my SKU. Cant figure it out how to delete it from all. Its like "ABC 123". Thanks for help!
I would first try to export all products as .csv (On the "All Products" Page, there should be an export button next to the "add new" button.).
Add ID and SKU to the export columns and download the file -> Open the file in excel, mark the SKU column -> find and replace the space with nothing -> replace all, then save the file as .csv
Now you can upload the file via the Import button next to the add new button. Tick the "update product" checkbox.
Now the importer will check if the ID exists,and update the SKU accordingly (ideally this works, I have not tried this, it might fail because SKU is also checked).
Make sure to first try it with one product only, or alternatively on a staging site.
If that doesn't work, you could make a Python script to update the SKU via the woocommerce API (https://woocommerce.github.io/woocommerce-rest-api-docs/?python#products). If it's worth the effort in contrast to changing the sku manually depends on the amount of products you have of course.
A plugin that allows bulk editing of products could be a solution too.
Related
I'm using a CSV to update product pricing rather than using the WooCommerce UI. The product ID's are respected and will be skipped by the Importer. Product Variations on the other hand do not have their ID's respected and the system will create new versions of the variations whenever I run the importer. This could be a problem as I want the Importer to not generate new product variations if the user uploading the CSV forgets to tick "Update Existing Products".
I have tried using the CSV to create the variations and then backfilling their ID's into the CSV. This did not help and instead the system still created new Product Variations for each Variant
Update:
Turns out WooCommerce just seemingly ignores the ID column and relies entirely on each Variant having a unique SKU.
So I set-up an excel formula to generate a unique SKU for each product and now it works as expected.
I want to change or reset the total_sales to 0 at worst.
When I modify in phpMyAdmin (wc_product_meta_lookup) nothing happens and everything goes back to the way it was before after a new order.
I searched for 2 hours without finding anything.
thank you in advance.
total_sales is a post meta field, a row in postmeta table. wc_product_meta_lookup just contains consolidated data from postmeta to avoid making multiple postmeta selects when product data are needed.
postmeta is the source of truth in this case, you need to set your desired value in there. Either directly in the database or using a custom field in the product edit view.
Reports (including total sales value in the dashboard widget) are dynamically generated, so I believe the value your setting in the database will just be set back to it's true value when WordPress runs.
According to the docs, you need to delete all prior orders (permanently) and clear your browser cache for new reports.
More info: https://docs.woocommerce.com/document/reports/#section-12
Background:
I inherited a website with a tremendously bloated product database. There are around 260 actual products which are translated using WPML into English and French which should make it for a total of 520 posts (for each product there is one same SKU two different IDs). However the total count of products in published status is over 720.
I exported all my products and realized that there is a third instance of some products with the same SKU and yet another ID but they are not associated to any category i.e The 'Categories' field is empty.
These are not variants are just ghost instances of the parent products.
Problem to solve:
I need to get rid of those 'ghost' products that have no Categories association. (I do have the list of offender IDs as a CSV)
If possible I would like to understand what those extra products. Can they be untranslated versions of the listing? are they just corrupted/invalid records?
I can do SQL or plugin or whatever it takes.
Difference in Product Count that shows invalid products
Thanks!
I've solved the problem by using the CLI shell in WordPress.
By simply SSHing into the backend I used the following syntax
wp wc product delete <ID> for trashing the product and you can add the --force to permanently delete it.
Having the list of offender IDs I just simply wrote a shell script that executed all the commands sequentially.
I do use nopCommerce 3.9 and I would like to insert coupon code from my C# program code. There are requirements such as "Has shopping cart amount" and "Blocked on product". The insert is working fine, I can see the inserted records and I think there are logically right. (The same process happening if I create Discount from Nop admin panel.)When I open the inserted coupon from Nop admin the "Discount info" tab is perfect, on the "Requirements" tab I see the requirements "Requirement Customer has x.xx amount in their shopping cart" and the "Requirement Block Discount on Product", but without value. If I modify the shopping cart value only (I don't modify the "blocked products" on purpose) and save it and reload the page, than everything is good. The blocked products are appeared too.
When I check the data tables I don't see any changes there. The records are the same as I inserted. I guess there is another table(s), where I have to update something, but I cannot find which one it is.
I would appreciate for any help.
From the comments, I believe OP want to insert the new discount rule with two things:
Cart has minimum total X.
Cart has specific product(s) Y.
And the issue is,
Its working properly if they apply discount rule from admin panel,
however, applying it programmatically couldn't store specific
products on a single call.
There are different tables for discount in nopCommerce.
Discount - main table
DiscountRequirement - stores requirement information
Discount_AppliedToProducts - stores discounted products information
Creating a discount rule first time will add entry in discount table only. Then the id of discount table will be used for reference to the DiscountRequirement and Discount_AppliedToProducts table.
It was everything good with my process. The issue was the nopCommerce cache. The nopCommerce keeps the discounts in cache. After I clear the cache I can see my values.
Thanks for everyone who tried to help or had a thought!
Have just finished adding all of my products onto woocommerce and have only just realized that my supplier has a CSV file available for the products.
Having never worked with CSV files before I am not sure if it is still worth importing this file or will this mess up the work I have already done? Now I have manually added all products and descriptions all I really need it for is to update current stock status.
Any ideas?
Thanks
What I would do is exporting your products from WooCommerce ( product listing ), compare and adjust this CSV sheet with your supplier's CSV sheet (Adding, removing, changing data) and then import the sheet back to WooCommerce