WPprodigy / woocommerce-product-fees

Add additional fees at checkout based on products that are in the cart.
https://wordpress.org/plugins/woocommerce-product-fees/
Other
26 stars 19 forks source link

Feature request:display a products setup fee in the cart, next to the product #51

Closed paddy-mceneaney closed 4 years ago

paddy-mceneaney commented 4 years ago

would it be possible to display a products setup fee in the cart, next to the product as well as the total fee at the end?

sorry about poor screen shot image

WPprodigy commented 4 years ago

Not something that will likely be added to the plugin, but this can still be accomplished. Would need to:

1) Add a new row column here to the cart table: https://github.com/woocommerce/woocommerce/blob/master/templates/cart/cart.php#L33

2) Add the contents for this column: https://github.com/woocommerce/woocommerce/blob/master/templates/cart/cart.php#L124. Could look like this:

<td class="product-setup-fee" data-title="Setup Fee">
    <?php
        $fee_name   = get_post_meta( $product_id, 'product-fee-name', true );
        $fee_amount = get_post_meta( $product_id, 'product-fee-name', true );

        if ( 'Setup Fee' === $fee_name ) {
            echo esc_html( $fee_amount );
        }
    ?>
</td>