Skip to content

feat: Add flexible item ID formatting options#5

Open
eclat-shubh wants to merge 4 commits into
stape-io:masterfrom
eclat-shubh:feature-id-formatting
Open

feat: Add flexible item ID formatting options#5
eclat-shubh wants to merge 4 commits into
stape-io:masterfrom
eclat-shubh:feature-id-formatting

Conversation

@eclat-shubh
Copy link
Copy Markdown

Hi Stape Team,

This pull request enhances the Universal Conversions Variable by adding a new "Product ID Format" selector. This allows users to easily choose which ID to send to various platforms, which is especially useful for custom Shopify setups.

Key Changes

  • Adds a "Product ID Format" dropdown with four options:

    • Default (uses the original 'Product ID/SKU' field)
    • Variant ID (uses the new 'Item Variant ID Key' field)
    • SKU (uses the new 'Item SKU Key' field)
    • Custom Shopify (builds 'shopify_MARKET_prod_var')
  • Adds new template fields to support this:

    • keyVariantId
    • keySku
    • marketCode
  • Adds a getFormattedId(item) helper function to implement the logic.

  • Updates all internal functions (like getItems, getContents, etc.) to use this new helper function for consistency.

  • Updates README.md and metadata.yaml to reflect the new version and features.

This change is fully backward-compatible. By default, the dropdown is set to "Default," so existing users will experience no change.

I look forward to your review!

This commit introduces a new feature to the Universal Conversions Variable, allowing users to select the format for product IDs sent to various platforms.

Previously, the template only used the value from the 'Product ID/SKU' field. This update adds a "Product ID Format" dropdown menu with four options:
- Default (uses the original 'Product ID/SKU' field)
- Variant ID (uses the new 'Item Variant ID Key' field)
- SKU (uses the new 'Item SKU Key' field)
- Custom Shopify (builds 'shopify_MARKET_prod_var')

To support this, the following new template fields were added:
- `idFormatType` (the dropdown)
- `keyVariantId`
- `keySku`
- `marketCode`

A new helper function, `getFormattedId(item)`, has been created to contain this new logic. All internal functions (getItems, getContents, getContentIds, etc.) have been updated to use this helper function instead of directly accessing the original `keyId` value.
This commit introduces a new feature to the Universal Conversions Variable, allowing users to select the format for product IDs sent to various platforms.

Previously, the template only used the value from the 'Product ID/SKU' field. This update adds a "Product ID Format" dropdown menu with four options:
- Default (uses the original 'Product ID/SKU' field)
- Variant ID (uses the new 'Item Variant ID Key' field)
- SKU (uses the new 'Item SKU Key' field)
- Custom Shopify (builds 'shopify_MARKET_prod_var')

To support this, the following new template fields were added:
- `idFormatType` (the dropdown)
- `keyVariantId`
- `keySku`
- `marketCode`

A new helper function, `getFormattedId(item)`, has been created to contain this new logic. All internal functions (getItems, getContents, getContentIds, etc.) have been updated to use this helper function instead of directly accessing the original `keyId` value.
Added a section on Product ID formatting with details on various ID options and requirements.
@giovaniortolani
Copy link
Copy Markdown
Contributor

Hi @eclat-shubh, please fix the template.tpl file. You overrode it with the GTM container .json export instead of the actual template.tpl file.

Copy link
Copy Markdown
Author

@eclat-shubh eclat-shubh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @giovaniortolani apologies for the mixup, I've fixed the template file now.

@giovaniortolani
Copy link
Copy Markdown
Contributor

Hi @eclat-shubh, thanks. We'll validate your suggestion and let you know.

@eclat-shubh
Copy link
Copy Markdown
Author

hi @giovaniortolani hope you are well, just a check-in if there were any issues with validation.

@giovaniortolani
Copy link
Copy Markdown
Contributor

Hi @eclat-shubh, it's still on our backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants