• Hi, what is your recomendation for having render_cart_page_elements used with woocommerce_after_cart_totals and not as it is currently on woocommerce_after_cart_totals ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Clearpay

    (@clearpayit)

    Hi @mareck1234,

    Thank you for your message.

    To add clarity to this enquiry, it sounds like a different hook would like to be used when rendering the Clearpay message and Express button (if Express Checkout is enabled). This functionality is not currently built into the plugin. A ticket has been raised internally to track discussion and prioritise the work.

    In the meantime, the following code should attach the render_cart_page_elements to the woocommerce_after_cart_totals hook (this can be added to the functions.php file):

    if (
        class_exists('WC_Gateway_Afterpay') &&
        method_exists('WC_Gateway_Afterpay', 'getInstance') &&
        method_exists(WC_Gateway_Afterpay::getInstance(), 'render_cart_page_elements')
    ) {
        remove_action( 'woocommerce_cart_totals_after_order_total', array(WC_Gateway_Afterpay::getInstance(), 'render_cart_page_elements'), 10, 0 );
        add_action( 'woocommerce_after_cart_totals', array(WC_Gateway_Afterpay::getInstance(), 'render_cart_page_elements'), 10, 0 );
    }

    Thank you.

    Plugin Author Clearpay

    (@clearpayit)

    Hi @mareck1234,

    Please excuse the error in the code block above. The correct class name for this plugin is WC_Gateway_Clearpay. Please find the amended code block below.

    if (
        class_exists('WC_Gateway_Clearpay') &&
        method_exists('WC_Gateway_Clearpay', 'getInstance') &&
        method_exists(WC_Gateway_Clearpay::getInstance(), 'render_cart_page_elements')
    ) {
        remove_action( 'woocommerce_cart_totals_after_order_total', array(WC_Gateway_Clearpay::getInstance(), 'render_cart_page_elements'), 10, 0 );
        add_action( 'woocommerce_after_cart_totals', array(WC_Gateway_Clearpay::getInstance(), 'render_cart_page_elements'), 10, 0 );
    }

    Thank you.

    • This reply was modified 1 year, 10 months ago by Clearpay.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘render_cart_page_elements placement’ is closed to new replies.