Creating your Own Watermarking Shortcodes for WooCommerce
You can add your own shortcodes to WaterWoo PDF Premium for on-the-fly customized watermarks. In this simple example we are going to create a shortcode to reflect a customer’s order total (price) in the watermark, when using a shortcode: [TOTAL_PRICE] function fetch_woo_order_data_as_shortcode( $input, $order_id, $product_id ) { // first we need to get the order object from the order id // you can get a lot of info from the order object ( $order in this case) $order = wc_get_order( $order_id ); // now let’s get the order data from the order object $order_data = $order->get_data(); $order_total = $order_data[‘total’]; // BINGO! // there is a ton of other data you can get from the WC order object data, check out // https://stackoverflow.com/questions/39401393/how-to-get-woocommerce-order-details // and substitute in what you need into the code that follows below // if there isn’t a continue reading…