• 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

Can I use a WooCommerce function without any WooCommerce page?

Display a product custom field only in WooCommerce Admin single orders

Prestashop cUrl Login

Detect emoticons in string

Wordpress 'post_type_link' hides permalink

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

How to Create WooCommerce Subscription Product via. REST API?

How to Create WooCommerce Subscription Product via. REST API?

How to install php yaml on CentOs?

How to Create WooCommerce Subscription Product via. REST API?

How to get the ID of the link in another page in php

Laravel Blade checkbox not checked

Yii2 redirecting to previous page after login

Convert PHP array into HTML tag attributes separated by spaces

PHPSpreadsheet - How Do I Use Auto Migration Tool

About Contact Privacy policy Terms and conditions