How to use one woocommerce for two websites?

I have website with subdomain. Main website is www.domain.com and second is subdomain.domain.com.
subdomain.domain.com is for shopping site powered by woocommerce. I have linked both website with same users & login. All works great but the problem is there is cart option where cart showing cart details on my subdomain.domain.com site but I want it on my main site (www.domain.com) also. So is there any way to display same value on both website or use single woocommerce installation for two websites.

for ref. I use this (https://themes.oitentaecinco.com/winner/) theme.
Thanks in Advance to help me……….

enter image description here

Go to Source
Author: Mahesh Gadgil

Settings checkbox not triggering function

I have recently created this code as a plugin to store a setting in the WooCommerce general settings. The checkbox is meant to

// Check if WooCommerce is active
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

    // Settings
    function hm_woo_disable_shop_settings( $settings ) {
        
        $settings[] = array(
            'title' => __( 'Disable Shop', 'wcds' ),
            'type' => 'title',
            'desc' => 'Check this box to disable all WooCommerce features',
            'id' => 'wcds_settings',
        );

        // Checkbox
        $settings[] = array(
            'title'             => __( 'Disable', 'woocommerce' ),
            'desc'              => __( 'This has no affect to the database and will only limit frontend functions', 'wcds' ),
            'id'                => 'wcds_checkbox',
            'default'           => '',
            'type'              => 'checkbox',
            'desc_tip'          => true,
            'value'             => get_option('wcds_checkbox'),
            'checked'           => esc_attr( checked( 1, get_option('wcds_checkbox'), false ) )
        );

        $settings[] = array( 'type' => 'sectionend', 'id' => 'wcds_settings' );
        return $settings;
    }
    add_filter( 'woocommerce_general_settings','hm_woo_disable_shop_settings', 10, 2 );
    

    // Functions
    function woocommerce_disable_shop() {
        
        global $woocommerce;

        // Get the checkbox value from settings
        if( get_option( 'wcds_checkbox' ) === '1' ) {
            add_filter( 'woocommerce_is_purchasable', '__return_false');
        }
        
    }
    add_action( 'init', 'woocommerce_disable_shop' );
    
}

Go to Source
Author: Jesse

Change WooCommerce backend Order_ID

I want to change the Order_ID Prefix on WooCommerce Order because the payment gateway only captures the order ID. As my payment gateway is integrated into three to five websites it is difficult differentiate which payment came from which website.

I have already implemented the Custom Sequential Pro Plugin from WooCommerce but it only changes the order ID on the front end. But the payment gateway collects Order ID from the backend. How can i add a prefix to the order_ID in the backend in WooCommerce.

images: woocommerce: https://pasteboard.co/JiGZcYR.png
Payment Gateway: https://pasteboard.co/JiGZOGY.png

Go to Source
Author: Aetzad Asghar

Make the product page as homepage WooCommerce

I’d like to make the product’s page as homepage. But this product’s page I created with Elementor Pro. I’m trying to use the shortcode [product_page id=99]. But it imports the standard page of theme, not the page I’ve created with Elementor. Someone knows how to do this?

Go to Source
Author: Gabriel Borges

Plugin getting error how to fix

[woocommerce-city-rate-shipping][1]

Hello, adding this plugin and getting error on order detail page.

 Fatal error: Uncaught Error: Call to a member function get_billing_state() on null in /home/evelineg/site.ge/wp-content/plugins/woocommerce-city-rate-shipping-master/city-rate-shipping.php:125 Stack trace: #0 /home/evelineg/site.ge/wp-includes/class-wp-hook.php(287): customize_checkout_city_field(Array) #1 /home/evelineg/site.ge/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array) #2 /home/evelineg/site.ge/wp-content/plugins/woocommerce/includes/class-wc-countries.php(737): apply_filters('woocommerce_def...', Array) #3 /home/evelineg/site.ge/wp-content/plugins/woocommerce/includes/class-wc-countries.php(1362): WC_Countries->get_default_address_fields() #4 /home/evelineg/site.ge/wp-content/plugins/woo-checkout-field-editor-pro/classes/class-thwcfd-utils.php(117): WC_Countries->get_address_fields('GE', 'shipping_') #5 /home/evelineg/site.ge/wp-content/plugins/woo-checkout-field-editor-pro/classes/class-thwcfd-settings-general.php(602): THWCFD_Utils::get_fields('shipping in /home/evelineg/site.ge/wp-content/plugins/woocommerce-city-rate-shipping-master/city-rate-shipping.php on line 125

Go to Source
Author: Irakli

Sale price formatting not showing [closed]

WordPress v5.4.2 | WooCommerce v3.7.1 | Theme: Salient v7.0.8

We have variable products with regular and sale prices set, and both prices display on the product page, however the sale price only has standard formatting, there’s no del-tag. So I assume function wc_format_sale_price is not being called. How can I fix this, or what settings should I check please?

function wc_format_sale_price( $regular_price, $sale_price ) {
    $price = '<del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>';
    return apply_filters( 'woocommerce_format_sale_price', $price, $regular_price, $sale_price );
}

Go to Source
Author: Nick W

I want to show either the WooCommerce Price OR the WooCommerce Bookings Price in a Divi module [closed]

I am using WooCommerce combined with WooCommerce Bookings.

We have two types of product, bookable products and nonbookable products. I would like to show the price for the product on the page within a Divi module. We are using Divi to completely style the page of the Divi product so I cannot use an override like I ususally would.

Is there a way to add some PHP code to the functions file then call it as a shortcode in a Divi module?

I tried adding this code to my functions.php within my child theme but when I call it it errors and won’t save the page.

functions.php

function woo_price_and_bookings_price ($atts)
{
    global $product;
    $product_id = $product->get_id();
    wc_get_product($product_id);
    echo '<h1>The price is: ' . $product->get_price_html() . '</h1>';
}
add_shortcode( 'price_and_bookings_price', 'woo_price_and_bookings_price' );

shortcode I am calling

[price_and_bookings_price]

The price does not appear, but my text does. However my text appears at the very top of the page and not in the position I have assigned it in Divi. The page also errors on save and seems to automatically open a new page whenever I do this.

The page that opens contains nothing except my code (twice for some reason):

The price is:

What am I doing wrong and is this the right way to approach this task? I need to use Divi as I have inherited the site and we are not using traditional product pages.

Go to Source
Author: Eoin

Woocommerce reports in front-end

I’m trying to create a custom report dashboard in the front-end with a nice chart with the daily sales, but I fail to retrieve the reports

what I tried which its giving me You have an error in your SQL syntax error is

function full_month_report(){
  include_once(WC()->plugin_path().'/includes/admin/reports/class-wc-admin-report.php');
  include_once(WC()->plugin_path(). '/includes/admin/reports/class-wc-report-sales-by-date.php' );
  $sales_by_date = new WC_Report_Sales_By_Date();
  $d = date_i18n('t');
  $d = (int)$d;
  $month_report = array();
  for($i = 1; $i <= $d; $i++){
    $i = sprintf("%02d", $i);
    $date = strtotime(date( 'Ym'.$i ));
    $sales_by_date->start_date = $date;
    $sales_by_date->end_date = $date;
    $day_report = $sales_by_date->get_report_data();
    array_push($day_report, $month_report);
  }
  return $month_report;
}

What’s the best way to get an object/array with the reports data in front-end?

Go to Source
Author: Razvan Cuceu

Edit tax class in Woocommerce admin order details

I am trying to make select box to change tax class at admin order detail in Woo. I made column, select box with tax classes, when the product is one, it works perfectly. But when i have more than 2 products it gets tax class what have the last of the list (you can see it in video). I would like to be able to set tax class for every item separately… Thanks for help

Here is video

My code in functions.php is like that

function tax_edit_col_h($order){
  ?>
  <th class="line_changetax">
    Změna daně
  </th>
  <?php
}
add_action( 'woocommerce_admin_order_item_headers', 'tax_edit_col_h' );


function tax_change($item_id, $item, $product) {
    if('line_item' === $item->get_type()){
    ?>
        <td class="line_changetax" style="width:20%">
            <select name="change_tax" id="change_tax_select" style="width:90%; display:inline-block">
                <?php
                $arraytax = WC_Tax::get_tax_class_slugs();
                    echo '<option value="'.$item->get_tax_class().'">'.$item->get_tax_class().'</option>';
                foreach($arraytax as $tax){
                    echo '<option value="'.$tax.'">'.$tax.'</option>';
                }
                ?>
            </select>
        </td>
    <?php
    }
}
add_action( 'woocommerce_admin_order_item_values', 'tax_change', 10, 3 );


function change_order_item_tax_class( $item ) {
    if (isset($_POST['change_tax']) ) {
        $item->set_tax_class($_POST['change_tax']);
    }
}
add_action( 'woocommerce_before_save_order_item', 'change_order_item_tax_class' ); 

Go to Source
Author: Jirka Kříž

Get/create the parent taxonomy by using shortcode in woocommerce?

How would I get/create the parent taxonomy by using shortcode in woocommerce?

My product categories should be like:

– Food

— Fruits

— Healthy Fruits
— Organic Fruits

— Meat

— Pork
— Lamb
— Beef

For example, I would like to display “Fruits” when user at the “Healthy Fruits” product archive page.

Go to Source
Author: Needa Hell

How to send “New Order” email to admin and manager with different email template?

How to send “New Order” email to admin and manager with different email template?

I am new with WordPress and I am just trying to send email to multiple user (admin, manager) but I want to customize the template for both the different user. I want to send email to both of them but the template should be different.

Example:

Admin should receive the email with full details(address, product with price etc) but when manager receives the email then it only includes that you have received an new order from this person, address and product name but should not include the price details on that email.

I have searched a lot regarding this but I have found the solution to include the multiple recipients but not with different templates.

Please anyone suggest me the best solution for this.

Go to Source
Author: Akshay Jain