WC_Connect_Service_Settings_Store::get_store_options PHP Method

get_store_options() public method

Gets woocommerce store options that are useful for all connect services
public get_store_options ( ) : object | array
return object | array
        public function get_store_options()
        {
            $currency_symbol = sanitize_text_field(html_entity_decode(get_woocommerce_currency_symbol()));
            $dimension_unit = sanitize_text_field(strtolower(get_option('woocommerce_dimension_unit')));
            $weight_unit = sanitize_text_field(strtolower(get_option('woocommerce_weight_unit')));
            return array('currency_symbol' => $currency_symbol, 'dimension_unit' => $this->translate_unit($dimension_unit), 'weight_unit' => $this->translate_unit($weight_unit));
        }

Usage Example

        public function meta_box($post)
        {
            $order = wc_get_order($post);
            $debug_page_uri = esc_url(add_query_arg(array('page' => 'wc-status', 'tab' => 'connect'), admin_url('admin.php')));
            $store_options = $this->settings_store->get_store_options();
            $root_view = 'wc-connect-create-shipping-label';
            $admin_array = array('purchaseURL' => get_rest_url(null, '/wc/v1/connect/label/purchase'), 'addressNormalizationURL' => get_rest_url(null, '/wc/v1/connect/normalize-address'), 'getRatesURL' => get_rest_url(null, '/wc/v1/connect/shipping-rates'), 'labelStatusURL' => get_rest_url(null, '/wc/v1/connect/label/' . $order->id . '-%d'), 'labelRefundURL' => get_rest_url(null, '/wc/v1/connect/label/' . $order->id . '-%d/refund'), 'labelsPreviewURL' => get_rest_url(null, '/wc/v1/connect/labels/preview'), 'labelsPrintURL' => get_rest_url(null, '/wc/v1/connect/labels/print'), 'paperSize' => $this->get_paper_size(), 'nonce' => wp_create_nonce('wp_rest'), 'rootView' => $root_view);
            $labels_data = get_post_meta($order->id, 'wc_connect_labels', true);
            if ($labels_data) {
                $admin_array['labelsData'] = json_decode($labels_data, true, WOOCOMMERCE_CONNECT_MAX_JSON_DECODE_DEPTH);
            } else {
                $store_options['countriesData'] = $this->get_states_map();
                $admin_array['formData'] = $this->get_form_data($order);
            }
            $admin_array['storeOptions'] = $store_options;
            wp_localize_script('wc_connect_admin', 'wcConnectData', $admin_array);
            wp_enqueue_script('wc_connect_admin');
            wp_enqueue_style('wc_connect_admin');
            ?>
			<div class="wc-connect-admin-container" id="<?php 
            echo esc_attr($root_view);
            ?>
">
				<span class="form-troubles" style="opacity: 0">
					<?php 
            printf(__('Shipping labels not loading? Visit the <a href="%s">status page</a> for troubleshooting steps.', 'connectforwoocommerce'), $debug_page_uri);
            ?>
				</span>
			</div>
			<?php 
        }
All Usage Examples Of WC_Connect_Service_Settings_Store::get_store_options