Reputation: 27
I have a problem where I've developed a website through Wordpress, and want to style all the product prices one way, and the subtotal, tax and total another way. They're all in a CSS class as woocommerce-Price-amount amount. Is there anyway I can only target the ones that are inside the tr "cart_item"? Thank you!
<table class="shop_table woocommerce-checkout-review-order-table" style="border-color: rgb(255, 255, 255);">
<thead style="background-color: rgb(0, 0, 0);">
<tr>
<th class="product-name" style="border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Product</th>
<th class="product-total" style="border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Total</th>
</tr>
</thead>
<tbody>
<tr class="cart_item">
<td class="product-name" style="border-color: rgb(255, 255, 255);">
Autumn Leaf Shirt - Large <strong class="product-quantity">× 2</strong> </td>
<td class="product-total" style="border-color: rgb(255, 255, 255);">
<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>70.00</span> </td>
</tr>
</tbody>
<tfoot>
<tr class="cart-subtotal">
<th style="background-color: rgb(0, 0, 0); border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Subtotal</th>
<td style="border-color: rgb(255, 255, 255);"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>70.00</span></td>
</tr>
<tr class="tax-total">
<th style="background-color: rgb(0, 0, 0); border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Tax</th>
<td style="border-color: rgb(255, 255, 255);"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>0.00</span></td>
</tr>
<tr class="order-total">
<th style="background-color: rgb(0, 0, 0); border-color: rgb(255, 255, 255); color: rgb(255, 255, 255);">Total</th>
<td style="border-color: rgb(255, 255, 255);"><strong><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>70.00</span></strong> </td>
</tr>
</tfoot>
Upvotes: 0
Views: 210
Reputation: 360
Yes! You can specifically target the woocommerce-price-item
inside cart_item
as:
.cart_item .woocommerce-Price-amount{
/**Your Properties here**/
}
This will only apply your properties to elements with class woocommerce-Price-amount
inside elements with class cart_item
Basically in CSS, you can access bar
inside foo
as:
.foo .bar{
}
Upvotes: 1