To Access WCPA Custom field value from Cart Object

To Access WCPA Custom field value from Cart Object

You can access the data from woocommmerce cart object. Below an example code which takes a particular custom field value 

global $woocommerce;
$items = $woocommerce->cart->get_cart();

if (isset($cart['wcpa_data']) && is_array($cart['wcpa_data'])) {

    foreach ($cart['wcpa_data'] as $v) {
        if ($v['name'] = "select-1589385422376") { // change this name with your field name
            echo $v['value'];
        }

    }

}
    • Related Articles

    • Styling Custom Product Addons

      The form fields in WCPA are easily customizable by styling it using CSS. There are numerous classes to style the fields in a form. You will be able to change the color, background, appearance and so on with using CSS and the concerned classes of the ...
    • PHP code to get the date of 10th day from today in the addon field

      Please use the below php function code to get the date of 10th day from today in the addon field  function getDateAfter($days=10) {     $formatted_date = new DateTime();     $date_timestamp = $formatted_date->getTimestamp();     // loop for X days ...
    • How to export order with Addon field values ?

      You need to instal  Advanced Order Export For WooCommerce. https://wordpress.org/plugins/woo-order-export-lite/ Using the above plugin you can export any custom field assigned to orders/products/coupons is easy and you can select from various formats ...
    • Why the pricing on paragraphs field is not showing in cart,checkout etc?

    • Flatsome theme Quick View Issue

      In WCPA Pro version features like pricing, conditional logic and other JavaScript related features will not work in quick view popup that come along with flatsome theme. It can fix only by directly modifying the JavaScript for quick view.   It needs ...