Skip to content

Add filter wc_sample_button_text and change product type to sample#7

Open
urosevic wants to merge 1 commit intoisikom:masterfrom
urosevic:master
Open

Add filter wc_sample_button_text and change product type to sample#7
urosevic wants to merge 1 commit intoisikom:masterfrom
urosevic:master

Conversation

@urosevic
Copy link
Copy Markdown

This is simple addition to make possible to change sample button text from functions.php w/o need to hack core plugin files, and also set product type of sample item in cart to sample.

Not sure will product type impact some plugins (can be utilized in custom shipping method plugins).

Here how text on button can be changed:

add_filter( 'wc_sample_button_text', 'custom_wc_sample_button_text' );
function custom_wc_sample_button_text( $button_text ) {
    return 'Add A Free Sample To Cart';
}

…set `sample` as product type in cart content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant