Feature Request: Change Notice Text2019-12-03T12:26:10+05:30

Home Forums Core Feature Request: Change Notice Text

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • jdizzle
    Participant
    Post count: 12

    Hey I’d like to be able to change the Notice’s text’s for all terawallet notices. Specifically the guest checkout for cash-back notice.
    Please log in to avail $0.02 cashback from this order.

    I’ve put together some code that automatically checks if its a guest checkout, then ties it to an existing account, or automatically creates an account for them to track all their data under. Therefore the message to guest’s isn’t necessary/ can be changed.

    Thanks.

    EDIT: Found it
    apply_filters(‘woo_wallet_cashback_notice_text’, ‘new_text’)

    Is there an official list of woo-wallet hooks and filters?

    jdizzle
    Participant
    Post count: 12

    Final fix. but would be nice to have this documented somewhere.

    add_filter(‘woo_wallet_cashback_notice_text’, ‘cash_back_text’);

    function cash_back_text() {
    $cashback_amount = woo_wallet()->cashback->calculate_cashback();
    if (is_user_logged_in()) {
    echo sprintf(__(‘Upon placing this order a cashback of %s will be credited to your wallet.’, ‘woo-wallet’), wc_price($cashback_amount, woo_wallet_wc_price_args()));
    } else {
    echo sprintf(__(‘TEST log in to avail %s cashback from this order.’, ‘woo-wallet’), esc_url(get_permalink(get_option(‘woocommerce_myaccount_page_id’))), wc_price($cashback_amount, woo_wallet_wc_price_args()));
    }
    }

    When in the else statement you can put whatever text you want. as you can see i put test as a test lol

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
WhatsApp