• nbelfort

    (@nbelfort)


    Where can I find the hooks for the Side Cart? I added a “custom item data” that is now displaying correctly at the regular cart, but it’s not showing at the side cart… How can I add the filter so the data is displayed similarly?

    Below is a filter that creates a “Weight subtotal” that is not showing at the side cart.

    Thanks in advace.

    add_filter( ‘woocommerce_get_item_data’, ‘display_custom_item_data’, 10, 2 );
    function display_custom_item_data( $cart_item_data, $cart_item ) {
    if ( $cart_item[‘data’]->get_weight() > 0 ){
    $cart_item_data[] = array(
    ‘name’ => __( ‘Weight subtotal’ , ‘woocommerce’ ),
    ‘value’ => ( number_format($cart_item[‘quantity’] * $cart_item[‘data’]->get_weight(),1) ) . ‘ ‘ . get_option(‘woocommerce_weight_unit’)
    );
    }
    return $cart_item_data;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author xootix

    (@xootix)

    Hello @nbelfort

    Please add this CSS & confirm if the item meta appears?

    .xoo-wsc-modal .variation:last-of-type {
        display: block!important;
    }
    Thread Starter nbelfort

    (@nbelfort)

    The new information is there! but it repeats previous information plus the new custom data, and it’s double space!

    example:

    1) without the CSS:
    Cut:Fillet Skin ONCut Size:6-8 oz

    2) with the new CSS:
    Cut:Fillet Skin ONCut Size:6-8 oz
    Cut:
    Fillet Skin ON

    Cut Size:
    6-8 oz

    Weight subtotal:
    4.4 lbs

    Thread Starter nbelfort

    (@nbelfort)

    See the HTML of the last example. The structure is very different.

    <dl class=”variation”>
    <dt>Cut:</dt>
    <dd>Fillet Skin ON</dd>
    <dt>Cut Size:</dt>
    <dd>6-8 oz</dd>
    </dl>

    <dl class=”variation”>
    <dt class=”variation-Cut”>Cut:</dt>
    <dd class=”variation-Cut”>
    <p>Fillet Skin ON</p>
    </dd>
    <dt class=”variation-CutSize”>Cut Size:</dt>
    <dd class=”variation-CutSize”>
    <p>6-8 oz</p>
    </dd>
    <dt class=”variation-Weightsubtotal”>Weight subtotal:</dt>
    <dd class=”variation-Weightsubtotal”>
    <p>4.4 lbs</p>
    </dd>
    </dl>

    Thread Starter nbelfort

    (@nbelfort)

    Working it around, I found this to make it similar.:

    .xoo-wsc-modal .variation:first-of-type { display:none; }
    .xoo-wsc-modal .variation:last-of-type { display: block!important; line-height: 100%;}

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Hooks’ is closed to new replies.