How to add a radio button with price on product page

How to add a radio button with price on product page? WordPress woocommerce Add to follows code snippets to achieve your work: [php]function add_custom_fees_before_add_to_cart() { global $product; $args = array( ‘type’ => ‘radio’, ‘class’ => array( ‘form-row-wide’ ), ‘options’ => array( ” => ‘No Option’, ’10’ => ‘Option 1 ($10)’, ’30’ => ‘Option 2 ($30)’, … Read more

How to Add a checkout birth date required field with adult control in Woocommerce

The following code adds a billing birth date field and will check customer age avoiding checkout if customer is not at least 18 year old: [php]// Adding a custom checkout date field add_filter( ‘woocommerce_billing_fields’, ‘add_birth_date_billing_field’, 20, 1 ); function add_birth_date_billing_field($billing_fields) { $billing_fields[‘billing_birth_date’] = array( ‘type’ => ‘date’, ‘label’ => __(‘Birth date’), ‘class’ => array(‘form-row-wide’), ‘priority’ … Read more

Woocommerce rating not showing in new custom theme

I am working on to new custom theme. I have installed woocommerce plugin. I have import product from xml files. I had tried to test rating functionality. Its working on wordpress default theme twentytwelve, twentysixteen. etc. But when I switched to my custom theme. comment section not showing rating. Take a look on screenshot. Comment … Read more

How to Access WooCommerce Order Details in Custom Plugin

actually i am creating a new plugin in this i want to get the order number and all other details but for now just the order number. For this i am using the following code which i get from Stackoverflow past answers. add_action( ‘wp_head’, ‘get_order_num’ ); function get_order_num($order_id) { global $woocommerce, $order; $order = new WC_Order($order->ID); print_r($order); die(); … Read more

Get Yoast SEO title for custom taxonomy – WordPress

I’m trying to get the SEO title from a custom taxonomy. Here’s my current code for it: $my_yoast_wpseo_title = get_term_meta( $term_id, ‘_wpseo_title’, true ); if( $my_yoast_wpseo_title ){ echo $my_yoast_wpseo_title; } else { echo ‘No title’; } It doesn’t work. So I tried different meta keys like _yoast_wpseo_title and everything I could find in their docs and other … Read more

Return the ID of the selected terms to array

My terms have an additional ACF true/false field. I need to get a list of all the term IDs with the field enabled and return a list of these IDs. So far I have achieved such a code, but it returns me only one ID: [php]function terms_exclude_id_func() { $terms_control = get_terms([ ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ … Read more

What are the different ways to detect home page in wordpress

What are the different ways to detect wordpress homepage except is_front_page() and is_home() Best Answer is_front_page() is what you want. I assume, by the fact that is_home() is not working, that your home page is static, according to the settings in wp-admin. is_home() returns true on your main blog page whereas is_front_page() returns true on which ever page is defined as your front page, … Read more

Why shouldn’t Use mysql_* functions in PHP

What are the technical reasons for why one shouldn’t use mysql_* functions? (e.g. mysql_query(), mysql_connect() or mysql_real_escape_string())? Why should I use something else even if they work on my site? If they don’t work on my site, why do I get errors like Warning: mysql_connect(): No such file or directory Best Answer The MySQL extension: Is not under active development Is officially deprecated as … Read more