Woocommerce Shop page variation product button replace with add to cart button

Do you mean you need to replace the button of select options with add to cart Please check below code add_filter( ‘woocommerce_product_add_to_cart_text’ , ‘custom_select_options_text’ ); function custom_select_options_text() { global $product; $product_type = $product->product_type; switch ( $product_type ) { case ‘subscription’: return __( ‘Options’, ‘woocommerce’ ); /*change ‘Options’ for Simple Subscriptions */ case ‘variable-subscription’: return __( … Read more

WordPress api call using wp-ajax returns error 400

I figured this out after a night sleep. Sometimes our brains function like that. The problem was actually my call here, It should’ve been “add_foo” not “_add_foo” data: { // the value of data.action is the part AFTER ‘wp_ajax_’ in // the add_action (‘wp_ajax_xxx’, ‘yyy’) in the PHP above action: ‘_add_foo’ // ANY other properties … Read more

Inject HTML meta tag inside wordpress tag using add_shortcode

First thing, wp_head action hook does not accept any argument at all, so am not sure whether the $url variable will be passed. To run the short code properly, you have to call do_shortcode(): add_action( ‘wp_head’, ‘refresh_page’ ); function refresh_page() { echo do_shortcode( “[refresh url=”http://stackoverflow.com”]” ); } add_shortcode( ‘refresh’, ‘refresh_shortcode’ ); function refresh_shortcode( $atts ) … Read more

How to Create a shortcode to this php function

You can use the add_shortcode function to do that. You just need to pass your isa_before_add_to_cart_form function as a shortcode like this: add_shortcode( ‘isa_show_link’, ‘isa_before_add_to_cart_form ); Now you can use the shortcode [isa_show_link] to display it anywhere. It’s simple.