Custom Text on Product Page based on Shipping Class [closed]

To display something above the product page, hook into woocommerce_before_single_product, and to get the shipping class use the get_shipping_class() method on the product, which can be retrieved with wc_get_product(): function wpse_295878_shipping_banner() { $product = wc_get_product(); $shipping_class = $product->get_shipping_class(); switch ( $shipping_class ) { case ‘free-shipping’: echo ‘<div class=”woocommerce-info”>Free shipping on this item</div>’; break; case ‘flat-rate’: … Read more

Woocommerce products are not displayed on front-end . No products were found matching your selection [closed]

WooCommerce products have a lot of metadata. Give a look at this answer to see most of them. In your case it seems that the problem is the missing _visibility. Did you already try something like this? $item = [ ‘post_title’ => $product[‘name’], ‘post_status’ => ‘publish’, ‘post_type’ => ‘product’, ]; $postId = wp_insert_post($item); update_post_meta( $postId, … Read more

Button to update order status Woocommerce with WC Marketplace

Thank you all, I did found the answer HERE. I adapt a bit the code to my needs and added a button. html: <div> <form method=”post” name=”update_status”> <button type=”submit” name=”marked_as_completed”>Mark as Completed</button> </form> </div> php: <?php if (isset($_POST[“marked_as_completed”])) { $completed_status = $order->get_id(); $order = new WC_Order($completed_status); $order->update_status(‘completed’, ‘order_note’); echo ‘<h2 style=”color:green;”>Completato &check;</h2>’; } ?>

Customize WooCommerce orders displayed shipping

There are mainly 2 filters to be used: 1) the filter woocommerce_order_shipping_to_display located in get_shipping_to_display() method, used by get_order_item_totals() method to display the shipping in order total rows: add_filter( ‘woocommerce_order_shipping_to_display’, ‘customize_order_shipping_to_display’, 10, 3 ); function customize_order_shipping_to_display( $shipping, $order, $tax_display ){ // Your code to filter displayed shipping return $shipping; } 2) Or filter woocommerce_get_order_item_totals located … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)