• 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

PHP - installing Xdebug on Mac with XAMPP (Unix File)

PHP Fatal error: Class not found - PHPUnit

Check if string contains a value in array [duplicate]

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Laravel query builder binding parameters more than once

How to redirect to another page after n seconds in wordpress without using javascript?

merge all files in directory to one text file

Confirm Leave on External Links in Wordpress

How to show selected value using javascript in laravel

PHP drop down list using array's and foreach (else and for) code

WooCommerce Additional Information - if empty, hide

Woocommerce product attributes with hierarchy like categories

Converting IPv6 to IPv4 address in PHP

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

PHP file_get_contents function

About Contact Privacy policy Terms and conditions