• Resolved jointmarketer

    (@jointmarketer)


    Good day…

    I’m using Rehub theme, but unfortunately, the cash back amount is not showing under each product like they do on this page: https://zumahia.com/buy/shop.

    I want the cashback amount to be visible under each product like they are on that page.

    Please what hook or code can I implement to achieve that?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jointmarketer

    (@jointmarketer)

    Please what hook do you use to inject cashback amount under each product in the product-wise settings?

    Thanks

    Plugin Author Subrata Mal

    (@subratamal)

    @jointmarketer We are using WooCommerce hook woocommerce_shop_loop_item_title and woocommerce_single_product_summary to display cashback amount at product page.

    Thread Starter jointmarketer

    (@jointmarketer)

    Thank you.

    Can this also be achieved with short codes?

    Plugin Author Subrata Mal

    (@subratamal)

    @jointmarketer Please use the attached shortcode.

    add_shortcode( 'product-cashback', 'product_cashback_shortcode_output' );
    if ( ! function_exists( 'product_cashback_shortcode_output' ) ) {
    function product_cashback_shortcode_output() {
    ob_start();
    $product = wc_get_product( get_the_ID() );
    if ( ! $product || is_wallet_account_locked() ) {
    return;
    }
    if ( $product->has_child() ) {
    $product = wc_get_product( current( $product->get_children() ) );
    }
    $cashback_amount = 0;
    if ( 'product' === woo_wallet()->settings_api->get_option( 'cashback_rule', '_wallet_settings_credit', 'cart' ) ) {
    $cashback_amount = woo_wallet()->cashback->get_product_cashback_amount( $product );
    } elseif ( 'product_cat' === woo_wallet()->settings_api->get_option( 'cashback_rule', '_wallet_settings_credit', 'cart' ) ) {
    $cashback_amount = woo_wallet()->cashback->get_product_category_wise_cashback_amount( $product );
    }
    $cashback_amount = apply_filters( 'woo_wallet_product_cashback_amount', $cashback_amount, get_the_ID() );
    if ( $cashback_amount ) {
    $cashback_html = '<span class="on-woo-wallet-cashback">' . wc_price( $cashback_amount, woo_wallet_wc_price_args() ) . __( ' Cashback', 'woo-wallet' ) . '</span>';
    } else {
    $cashback_html = '<span class="on-woo-wallet-cashback" style="display:none;"></span>';
    }
    echo apply_filters( 'woo_wallet_product_cashback_html', $cashback_html, get_the_ID() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    return ob_get_clean();
    }
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.