Bulk accept Product Category suggestion

Hi all,

According to this: https://help.shopify.com/en/manual/taxes/shopify-tax/product-categories-tax I should have the option to accept all suggestions. But right now it is taking me to the Bulk editor, and in there I don’t see an option to accept all suggestions. It’s about 60k products

1 Like

If someone else reading this, this is the answer from support:

I did check on your products and the reason you’re not seeing the option to edit all of the categories in bulk as shown in the Help Center is because not all products have suggestions set in it or is uncategorized. In this case, we’ll have to manually provide the categories for the products.

I know, this does not make sense at all. It would have bin a lot easier to just accept all that do have a suggestion.. If you want you can run this script in the browser inspect to accept the 50 that are shown, save and do this in a loop 10 iterations, after that it crashes. So this accepts 1000 products in a loop. Refresh and run again if you have more.

(async function processProducts() {
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); // Helper to wait for a given time
let iterationCount = 0; // Initialize iteration counter
const maxIterations = 10; // Set the maximum number of iterations

while (iterationCount < maxIterations) {
console.log(Starting iteration ${iterationCount + 1});

// Step 1: Accept all category suggestions
document.querySelectorAll(‘button._ProductCategoryFieldButton_9anqn_62’).forEach(button => {
const icon = button.querySelector(‘shopify-internal-icon[type=“check-circle”]’);
if (icon) {
button.click(); // Click the “Accept” button
}
});

// Step 2: Click the “Save” button
const saveButton = document.querySelector(‘button.Polaris-Button–variantPrimary’);
if (saveButton && saveButton.textContent.includes(‘Save’)) {
saveButton.click();
console.log(‘Save button clicked.’);
}

// Step 3: Wait for the next set of products to load
// Adjust delay as needed to match loading time
await delay(3000); // Wait 3 seconds for the next batch to load

// Step 4: Increment the iteration counter
iterationCount++;
console.log(Iteration ${iterationCount} completed.);

// Step 5: Check if there are more products to process
const moreProducts = document.querySelector(‘button._ProductCategoryFieldButton_9anqn_62’);
if (!moreProducts) {
console.log(‘No more products to process.’);
break; // Exit the loop if no more products are found
}
}

console.log(‘Processing complete or maximum iterations reached.’);
})();

Am I supposed to do this in the bulk editor? What page in the admin do I use this script? I have about 1000 products to edit and want to accept all suggestions.

Hi @IPPowerhouse , No in the Chrome Inspect. Go to “console”. Paste it in and then hit enter

1 Like

On What page do I do this? In the product detail page?

In the bulk editor. Make sure the column is visible and you have filtered on productes where the category is empty

Oddly these suggestions dont show up even when I show the columns. I have to go into each product. I use Firefox, can I still use the inspector in there anyways? Thanks for the guidance.

What a pain in the butt. They seriously can’t build in an “accept all” button? Another annoyance with bulk editing is the inability to expand or collapse all.

I would assume this is an easy feature to impliment and would really help customers with very large catalogs.

I am getting a syntax error in google console with this script. console.log (Starting iteration ${iterationCount + 1}); VM2422:7 Uncaught SyntaxError: missing ) after argument list

I cannot see where it is missing from the line it gave me