Skip to content

Conversation

@abdomursal
Copy link
Contributor

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • Bug fix

What is the current behaviour? (You can also link to an open issue here)

  • cost of shipping is showing in cart even the shipping becomes free SP-10922
    What is the new behaviour? (You can also link to the ticket here)

  • hide shipping cost in the cart

Does this PR introduce a breaking change?

Screenshots (If appropriate)

Copilot AI review requested due to automatic review settings August 7, 2025 11:22
@sallainternalbot sallainternalbot bot marked this pull request as draft August 7, 2025 11:22
@abdomursal abdomursal marked this pull request as ready for review August 7, 2025 11:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where shipping costs were being displayed in the cart even when free shipping was available. The fix ensures that when free shipping is active, the shipping cost element is hidden from the cart display.

  • Updates the visibility logic for shipping costs to check both real shipping cost and free shipping status
  • Hides shipping cost display when free shipping is active

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/assets/js/cart.js Modified condition to hide shipping cost when free shipping is available
public/checkout.js Compiled/minified JavaScript file reflecting the source changes


app.toggleElementClassIf(app.totalDiscount, 'discounted', 'hidden', () => !!cartData.total_discount)
.toggleElementClassIf(app.shippingCost, 'has_shipping', 'hidden', () => !!cartData.real_shipping_cost)
.toggleElementClassIf(app.shippingCost, 'has_shipping', 'hidden', () => !!cartData.real_shipping_cost && !cartData.free_shipping_bar?.has_free_shipping)
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

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

[nitpick] The condition is now complex and could be extracted into a well-named variable for better readability. Consider something like const shouldShowShipping = !!cartData.real_shipping_cost && !cartData.free_shipping_bar?.has_free_shipping;

Copilot uses AI. Check for mistakes.
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.

1 participant