Mugs', '', '', '', '', '', '' ), array( 'simple', 'SAMPLE-CAP', 'Sample cap', '1', $price( '18.00' ), $price( '15.00' ), '25', 'Clothing > Caps', '', '', '', '', '', '' ), array( 'simple', 'SAMPLE-BAG', 'Sample tote bag', '1', $price( '9.90' ), '', '100', 'Bags', '', '', '', '', '', '' ), array( 'variable', 'SAMPLE-TEE', 'Sample t-shirt', '1', '', '', '', 'Clothing > T-shirts', '', '', 'Size', 'S, M, L', '1', '0' ), array( 'variation', 'SAMPLE-TEE-S', '', '1', $price( '19.99' ), '', '10', '', '', 'SAMPLE-TEE', 'Size', 'S', '', '' ), array( 'variation', 'SAMPLE-TEE-M', '', '1', $price( '19.99' ), '', '12', '', '', 'SAMPLE-TEE', 'Size', 'M', '', '' ), array( 'variation', 'SAMPLE-TEE-L', '', '1', $price( '21.99' ), '', '8', '', '', 'SAMPLE-TEE', 'Size', 'L', '', '' ), ); } /** * Write the CSV to a stream. * * @param resource $stream Stream. * @param string $dec Decimal separator. * @return void */ public static function write( $stream, string $dec = '.' ): void { fwrite( $stream, "\xEF\xBB\xBF" ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite CsvSafe::put( $stream, self::header() ); foreach ( self::rows( $dec ) as $row ) { CsvSafe::put( $stream, $row ); } } }