Include external po file for 3th party plugin to theme

If discussed plugin already uses load_plugin_textdomain() function to load its translations, usually it is enough to place <plugin_name>-<locale_code>.mo file to the wp-content/languages/plugins directory. If it doesn’t (or you can’t do it for some reason), you can use init hook to load its translation via your functions.php. Here is an example from one of my child … Read more

Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial

WordPress is inlining the style as an optimisation: When a page gets rendered, stylesheets that have opted-in to get inlined get added to an array. Their size is retrieved using a filesize call (which is why the path data is necessary), and the array is then ordered by ascending size (smaller to larger stylesheet). We … Read more

Count products with custom metadata field in an order

{ $userid=””; $integration_status=””; // Get an instance of the WC_Order object $order = wc_get_order( $order_id ); $email = $order->get_billing_email(); $name = $order->get_billing_first_name(); $items = $order->get_items(); $devicecount =0; foreach ( $items as $item ) { $product_name = $item->get_name(); $product_id = $item->get_product_id(); $product_variation_id = $item->get_variation_id(); $productToBeIntegrated=get_post_meta($product_id,’_wootraccar_integration’, true); //$integration_status.=$productToBeIntegrated; if ($productToBeIntegrated==”yes”) { $devicecount = $devicecount + $item->get_quantity(); $integration_status.=$devicecount; … Read more