WordPress staging environment

Generally speaking other “answers” here are correct, there are alternatives to WordPress that have better built-in support for staging environments and build migrations. However the suggested alternatives aren’t exactly equal substitutes to the WordPress platform, so I think it’s best to answer the question at hand instead. WordPress does not natively support hosting the same … Read more

How to Disable add to cart button via custom checkbox

Disable add to cart button via custom checkbox in WooCommerce product settings Explanation via comment tags added in the code To add a checkbox to the inventory product options, use: [php]// Add checkbox function action_woocommerce_product_options_inventory_product_data() { // Checkbox woocommerce_wp_checkbox( array( ‘id’ => ‘_prevent_add_to_cart_button’, // Required, it’s the meta_key for storing the value (is checked or … Read more

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