Snippets Collections
    $_product = wc_get_product( $post_id );

    if( $_product->is_type( 'simple' ) ) {
    // do stuff for simple products
    } else {
    // do stuff for everything else
    }
/* This will come in the body at XML but the header will be text/plain, which is why  
all this is happening manually to get this read from the stream.  
*/  
var reqHeaders = request.headers;
gs.info("CPSNS: reqHeaders content-type" + reqHeaders['content-type']);
if (reqHeaders['content-type'] == "text/plain; charset=UTF-8") {
    var stream = request.body.dataStream;
    var reader = new GlideTextReader(stream);
    var input = "";
    var ln = "";
    while ((ln = reader.readLine()) != null) {
        input += ln;
    }
    gs.info("CPSNS: SUB" + input);
} else {
    var body = {};
    var data = request.body.data;

    gs.info("CPSNS: req.body data" + data);

}
star

Tue May 31 2022 09:47:25 GMT+0000 (Coordinated Universal Time)

#woocommerce #product #type #php
star

Mon Feb 01 2021 21:22:08 GMT+0000 (Coordinated Universal Time) https://developer.servicenow.com/blog.do?p

#servicenow #content #type #plain #text

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension