• 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

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

PHP: How to solve ob_start() in combination imagepng() issue?

WooCommerce - unset "<product> removed notice…" on cart page

Add Class in html Dynamically in PHP

How can i hide dt if dd got empty value

Installing Composer - Internal Error

Undefined Array Key error when uploading image on php

How to get quarter for future date using Carbon?

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

get attribute from class not working php 7

How to use PHPCBF to fix one issue at a time?

Laravel 4 Redirect::back() not going to previous page (refreshing current page)

could not find driver Debian SQL Server PHP

XML to CSV with PHP converter [problem with images grabing]

How to get page number on dompdf PDF when using "view"

About Contact Privacy policy Terms and conditions