Creating a Feed Rule for Custom Products in GMC

We sell a significant number of products for which there are no assigned UPCs. In Shopify, these products have numbers in the Barcode field that are generated by an app called Retail Barcode Labels, which we use to print scannable price labels for POS.

As they are not official barcodes, these numbers are not recognized as GTINs by Google Merchant Center.

I understand there is a way to set up Feed Rules to clear these numbers, however, I can’t seem to get this Feed Rule to work.

I created a rule that said If content.Api GTIN does not match regular expression ^\d(12,14)$ then clear the GTIN attribute. However, when I ran a test, it returned results that indicated that a considerable amount of our products with legitimate barcodes within the 12-14 digit range would have their GTIN’s cleared. One example is UPC 9781639470303.

Am I setting up the Feed Rule wrong? Wouldn’t that UPC fall outside the parameters of that rule?

Hi there,

I dont quite understand how your clear rule regex is supposed to be distinguishing between your legitimate barcodes and the ones created by the Retail Barcode Labels app?

This regex ^\d{12,14}$ is simply matching any string that is all digits with a minimum length or 12 characters and a max of 14 .. I suppose that your real GTINs match this also??, so it will clear them all

There needs to be some pattern logic applied if this is going to work

e.g. if all your fake barcodes start with a 9 but none of your real ones do - your remove rule could be

^9\d{11,13}$

And it would only match with the ones you want to remove. But it may be another pattern thats needed here

Best regards

Martin

The regular expression you are using, does not check if the barcode is real, just that it is between 12 and 14 digits. Which covers the range of possible valid barcodes.

The code @FeedDonkeyApp suggested is a great alternative.

If there is no pattern starting with a fixed digit, then you may use a supplement feed to identify all the products you need to clear the barcode for.

Column 1 is the ID and column 2 is for example a heading called exclude.

Now in the second row add your ID an A2, and add true in B2

In Google merchant center, create a feed rule that says, if supplement feed.exclude contains true, clear gtin.

The fake barcodes are 8 digits long. So in theory, wouldn’t a feed rule that says If content.Api GTIN does not match regular expression ^\d(12,14)$ then clear the GTIN attribute clear those fake 8 digit GTIN’s and leave the real ones, which are all between 12 and 14 digits? But when I ran the test, it’s clearing many legitimate GTINs, for example9781639470303.

Ah sorry, I didn’t quite read it correctly the first time around.. I understand your point now

Yes exactly, your regex in theory should have had the desired effect..

^\d{12,14}$.. should not match with an 8 digit barcode, so correct the rule should work

I would be tempted to switch it around as a test, so instead of does not match expression, make it does match, then see if the result is better

So the regex would be either

^\d{8}$

..clear where it’s digit string, exactly 8 characters

or maybe make it clear everything that’s too short to be a real GTIN?

:backhand_index_pointing_down:

^\d{1,11}$