Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checkout-cart-url flag #2923

Merged
merged 1 commit into from
Oct 6, 2023
Merged

Conversation

alvaro-shopify
Copy link
Contributor

@alvaro-shopify alvaro-shopify commented Oct 3, 2023

WHY are these changes introduced?

Running the dev command with the flag checkout-cart-url is not working with checkout ui extensions generated from the new template. The product shown when you visit the checkout extension preview url is different to the one you set in the flag

There are some issues to dev checkout ui extensions in spin because an error is returned from the admin api when the product variant is fetched. Using the flag is not working as workaround

WHAT is this pull request doing?

  • Remove the old method that built the url. It was receiving the cart url flag value and in case there are no checkout_ui_extension type it returned undefined as the cart url, so the flag value is lost. New checkout ui extensions have the generic ui-extension type, so we should filter them using the method shouldFetchCartUrl which applies to the old and new checkout ui extensions
  • Remove duplicate call to the cart url build method inside the execution of the dev ui process.

How to test your changes?

Test 1

  • Run the dev command with one product variant
p shopify app dev --path /path/to/your/app  --checkout-cart-url /cart/43823180349462:1
  • Visit the checkout ui extension preview url and the product variant displayed in the cart should match the one you set in the flag

Test 2

  • Run the dev command without the flag
p shopify app dev --path /path/to/your/app 
  • Visit the checkout ui extension preview url and you should see a random product from your store

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2023

We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
74% (+0.07% 🔼)
6079/8215
🟡 Branches
71.2% (+0.07% 🔼)
2971/4173
🟡 Functions
72.53% (+0.07% 🔼)
1550/2137
🟡 Lines
75.3% (+0.05% 🔼)
5767/7659
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / previewable-extension.ts
77.78% (+7.19% 🔼)
50%
66.67% (-13.33% 🔻)
75% (+5.77% 🔼)

Test suite run success

1441 tests passing in 673 suites.

Report generated by 🧪jest coverage report action from 3107ce4

Copy link
Contributor

@isaacroldan isaacroldan left a comment

Choose a reason for hiding this comment

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

Good catch 👌

@alvaro-shopify alvaro-shopify added this pull request to the merge queue Oct 6, 2023
Merged via the queue into main with commit b96ef7f Oct 6, 2023
1 check passed
@alvaro-shopify alvaro-shopify deleted the remove-duplicated-cart-url-building branch October 6, 2023 07:51
@shopify-shipit shopify-shipit bot temporarily deployed to nightly October 6, 2023 10:19 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to experimental October 9, 2023 09:43 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production October 19, 2023 13:18 Inactive
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