• 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

Doctrine 2 mapping referencing unique key

CONCAT columns with Laravel 5 eloquent

Adding Multiple Custom Post Types in Wordpress

Target Laravelista is not instantiable

how can I set a session variable in Drupal 8 and get it in a php script?

get folder directory from input type file - PHP

advanced custom fields wordpress custom class

Adding custom body class to the custom archive pages

How to get total pages of PDF with FPDF?

Cache clear probem in Larave

Parameter is not sent to Laravel route in Ajax

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

Get WooCommerce products from specific category

How to Create WooCommerce Subscription Product via. REST API?

About Contact Privacy policy Terms and conditions