• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Get all WooCommerce products within own plugin

phpwordpresswoocommerceproducthook-woocommerce


PHP Snippet 1:

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
        // Put your plugin code here
        add_action( 'woocommerce_loaded', 'generate_product_qr_codes' );
    }
    
    function generate_product_qr_codes() {
    
        $args        = array( 'post_type' => 'product', 'posts_per_page' => -1 );
        $products    = get_posts( $args );
        echo '<pre>$products:-';
        print_r( $products );
        echo '</pre>';
    }

Related Snippets

Getting public posts of a random user from Facebook API

Wordpress add responsive srcset header image to theme

How to map the two arrays with a duplicate value?

How to submit the custom form data in database in WordPress without plugin using ajax?

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Utf8 encoding issue with Laravel

Check if my GET request has Header: Token

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

Call authenticate manually in router middleware

How to debug in WooCommerce 3+

Google Calendar API batch request PHP

Class AppHttpControllersUserController Does Not Exist

Is there a way to use Foundry Model for Authentification inside Functional Tests?

Get orders by date and status woocommerce

Adding hreflang tags automatically in WordPress subdirectory multisite

About Contact Privacy policy Terms and conditions