Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add fee ID/key to parent cart and checkout block #11054

Merged

Conversation

larsenlarsson
Copy link
Contributor

@larsenlarsson larsenlarsson commented Sep 26, 2023

What

Add the ID of a fee to the parent DIV in cart and checkout block.
So
<div class="wc-block-components-totals-item wc-block-components-totals-fees">
becomes
<div class="wc-block-components-totals-item wc-block-components-totals-fees wc-block-components-totals-fees__fee-1">

see discussion:
https://github.com/woocommerce/woocommerce-blocks/discussions/11041#discussioncomment-7103099
closes #11053

Why

To add styles to a specific fee or other data with css (content-attribute).

Testing Instructions

  • add a fee to you cart, for example by using this code in your functions.php
add_action( 'woocommerce_cart_calculate_fees', function( $cart ) {
	$cart->add_fee( 'Fee 0', 5, true );
	$cart->add_fee( 'Fee 2', 10, true );
	$cart->add_fee( 'Fee 3', 50, true );
});

  • go to your cart or checkout block
  • check the CSS classes of the fee elements with your browser developer tool
  • Do not include in the Testing Notes
  • Should be tested by the development team exclusively

Screenshots or screencast

screen

WooCommerce Visibility

Required:

  • WooCommerce Core
  • Feature plugin
  • Experimental
  • N/A

Checklist

Required:

  • This PR has either a [type] label or a [skip-changelog] label.
  • This PR is assigned to a milestone.

Conditional:

  • This PR has a changelog description (if [skip-changelog] label is not present).
  • This PR adds/removes a feature flag & I've updated this doc.
  • This PR adds/removes an experimental interfaces, and I've updated this doc.
  • This PR has been accessibility tested.
  • This PR has had any necessary documentation added/updated.

Changelog

Add fee ID to parent cart and checkout block.

@senadir senadir requested review from a team and senadir and removed request for a team September 26, 2023 12:07
@senadir senadir added block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. labels Sep 26, 2023
@ralucaStan ralucaStan requested review from a team and nielslange and removed request for senadir and a team September 27, 2023 13:33
@nielslange nielslange force-pushed the fee-id-in-cart-and-checkout-block branch from 31d5423 to 19fb44b Compare September 29, 2023 05:53
Copy link
Member

@nielslange nielslange left a comment

Choose a reason for hiding this comment

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

Thank you so much for your contribution, @larsenlarsson! The change works as expected and all CI tests are passing. I'll be merging this PR now. Thanks for improving WooCommerce Blocks! 🙌

@nielslange nielslange added the type: enhancement The issue is a request for an enhancement. label Sep 29, 2023
@nielslange nielslange added this to the 11.3.0 milestone Sep 29, 2023
@nielslange nielslange merged commit 33a25fb into woocommerce:trunk Sep 29, 2023
65 of 70 checks passed
@nielslange nielslange mentioned this pull request Sep 29, 2023
@roykho roykho changed the title #11053 added fee id Add fee ID/key to parent cart and checkout block Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. type: community contribution type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cart & Checkout Block: Fees: Add fee-ID as CSS-class
3 participants