• 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

Parameter is not sent to Laravel route in Ajax

How to KeyBy where multiple items have the same key

How do I enable error reporting in Laravel?

how to pass row id in href of a tag in codeigniter controller?

Update Order custom Field value with WooCommerce REST API

How to change 'users' auth table and use another instead Laravel

Adding multiple items to WooCommerce cart at once

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

Add restriction to WooCommerce coupons by allowed user ID

Laravel multi auth - Authentication user provider [] is not defined

virtctl works when executed via command line but not from php exec()

Wordpress how to get the post thumbnail inside a figure tag

array_map triple dimensional array [duplicate]

Magento Installation SQLSTATE[HY000] [2002] No such file or directory error

WHM Enabling mod_rewrite

About Contact Privacy policy Terms and conditions