improved structured data - merge conflict fix

This commit is contained in:
opportus 2016-09-01 14:15:15 +02:00
commit 53a257bb91
345 changed files with 4529 additions and 3969 deletions

View File

@ -24,8 +24,36 @@ matrix:
before_script:
- bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
- bash tests/bin/travis.sh before
# Install CodeSniffer for WordPress Coding Standards checks.
- git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git /tmp/phpcs
# Install WordPress Coding Standards.
- git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git /tmp/sniffs
# Install PHP Compatibility sniffs.
- git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git /tmp/sniffs/PHPCompatibility
# Set install path for PHPCS sniffs.
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
- /tmp/phpcs/scripts/phpcs --config-set installed_paths /tmp/sniffs
# After CodeSniffer install you should refresh your path.
- phpenv rehash
script: phpunit -c phpunit.xml.dist
script:
# Search for PHP syntax errors.
- find . \( -name '*.php' -not -path "./vendor/*" \) -exec php -lf {} \;
# Run PHPUnit tests.
- phpunit -c phpunit.xml.dist
# WordPress Coding Standards.
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
# @link http://pear.php.net/package/PHP_CodeSniffer/
# -p flag: Show progress of the run.
# -s flag: Show sniff codes in all reports.
# -v flag: Print verbose output.
# -n flag: Do not print warnings. (shortcut for --warning-severity=0)
# --standard: Use WordPress as the standard.
# --extensions: Only sniff PHP files.
- /tmp/phpcs/scripts/phpcs -p -s -v -n ./*.php --standard=./phpcs.ruleset.xml --extensions=php
- /tmp/phpcs/scripts/phpcs -p -s -v -n ./**/*.php --standard=./phpcs.ruleset.xml --extensions=php --ignore=./vendor/*.php
- /tmp/phpcs/scripts/phpcs -p -s -v -n ./**/**/*.php --standard=./phpcs.ruleset.xml --extensions=php --ignore=./vendor/**/*.php
- /tmp/phpcs/scripts/phpcs -p -s -v -n ./**/**/**/*.php --standard=./phpcs.ruleset.xml --extensions=php --ignore=./vendor/**/**/*.php
after_script:
- bash tests/bin/travis.sh after

View File

@ -14,7 +14,7 @@ class WC_HookFinder {
if ( ! $path && ( $dir = dirname( $pattern ) ) != '.' ) {
if ($dir == '\\' || $dir == '/') { $dir = ''; } // End IF Statement
if ( $dir == '\\' || $dir == '/' ) { $dir = ''; } // End IF Statement
return self::get_files(basename( $pattern ), $flags, $dir . '/' );
@ -37,7 +37,6 @@ class WC_HookFinder {
if ( is_array( $files ) && is_array( $found_files ) ) {
$files = array_merge( $files, $found_files );
}
} // End FOREACH Loop
}
return $files;
@ -169,7 +168,7 @@ class WC_HookFinder {
'class' => $current_class,
'function' => $current_function,
'file' => array( self::$current_file ),
'type' => $token_type
'type' => $token_type,
);
}
break;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

51
assets/images/icons/credit-cards/mastercard.svg Executable file → Normal file
View File

@ -1,34 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="750px" height="471px" viewBox="0 0 750 471" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.3.1 (12005) - http://www.bohemiancoding.com/sketch -->
<svg width="750px" height="471px" viewBox="0 0 750 471" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
<title>Slice 1</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="mastercard" sketch:type="MSLayerGroup">
<rect id="Rectangle-1" fill="#000000" sketch:type="MSShapeGroup" x="0" y="0" width="750" height="471" rx="40"></rect>
<path d="M434.008334,235.5 C434.008334,334.641668 353.6375,415.004169 254.499999,415.004169 C155.362498,415.004169 74.9999973,334.641668 74.9999973,235.5 C74.9999973,136.366666 155.362498,55.9958324 254.499999,55.9958324 C353.6375,55.9958324 434.008334,136.366666 434.008334,235.5" id="Fill-1" fill="#D9222A" sketch:type="MSShapeGroup"></path>
<path d="M495.491667,55.9958324 C449.1125,55.9958324 406.85,73.5916658 374.991666,102.462499 C368.504166,108.345833 362.445833,114.7 356.866666,121.458333 L393.133333,121.458333 C398.091667,127.4875 402.658333,133.829166 406.816667,140.470833 L343.183333,140.470833 C339.370833,146.575 335.908333,152.916666 332.841666,159.479167 L417.154167,159.479167 C420.033333,165.6375 422.575,171.975 424.754167,178.483333 L325.241666,178.483333 C323.166666,184.675 321.420833,191.0125 320.024999,197.491667 L429.966667,197.491667 C432.604167,209.741667 434.008334,222.458334 434.008334,235.5 C434.008334,255.433334 430.754167,274.612501 424.754167,292.520834 L325.241666,292.520834 C327.416666,299.033334 329.958333,305.375001 332.837499,311.529168 L417.154167,311.529168 C414.079167,318.091668 410.625,324.433335 406.808333,330.541668 L343.183333,330.541668 C347.3375,337.170835 351.9125,343.520835 356.866666,349.537501 L393.125,349.537501 C387.554167,356.308335 381.491666,362.670835 374.995833,368.550002 C406.854167,397.416668 449.1125,415.004169 495.491667,415.004169 C594.629168,415.004169 675.000002,334.641668 675.000002,235.5 C675.000002,136.370833 594.629168,55.9958324 495.491667,55.9958324" id="Fill-2" fill="#EE9F2D" sketch:type="MSShapeGroup"></path>
<path d="M651.075002,335.558335 C651.075002,332.358335 653.666669,329.758335 656.870835,329.758335 C660.075002,329.758335 662.666669,332.358335 662.666669,335.558335 C662.666669,338.758335 660.075002,341.358335 656.870835,341.358335 C653.666669,341.358335 651.075002,338.758335 651.075002,335.558335 L651.075002,335.558335 L651.075002,335.558335 Z M656.870835,339.966668 C659.304169,339.966668 661.279169,337.991668 661.279169,335.558335 C661.279169,333.120835 659.304169,331.154168 656.870835,331.154168 C654.433335,331.154168 652.466669,333.120835 652.466669,335.558335 C652.466669,337.991668 654.433335,339.966668 656.870835,339.966668 L656.870835,339.966668 L656.870835,339.966668 Z M656.087502,338.108335 L654.900002,338.108335 L654.900002,333.012501 L657.050002,333.012501 C657.500002,333.012501 657.958335,333.012501 658.354169,333.266668 C658.766669,333.545835 659.000002,334.037501 659.000002,334.545835 C659.000002,335.116668 658.662502,335.650001 658.116669,335.858335 L659.054169,338.108335 L657.737502,338.108335 L656.958335,336.091668 L656.087502,336.091668 L656.087502,338.108335 L656.087502,338.108335 Z M656.087502,335.216668 L656.745835,335.216668 C656.991669,335.216668 657.250002,335.237501 657.470835,335.116668 C657.666669,334.991668 657.766669,334.758335 657.766669,334.533335 C657.766669,334.337501 657.645835,334.112501 657.479169,334.016668 C657.270835,333.887501 656.941669,333.916668 656.720835,333.916668 L656.087502,333.916668 L656.087502,335.216668 L656.087502,335.216668 Z" id="Fill-3" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M212.587498,255.154167 C210.541665,254.916667 209.641665,254.854167 208.237498,254.854167 C197.191665,254.854167 191.599998,258.641667 191.599998,266.120834 C191.599998,270.733334 194.329165,273.666667 198.587498,273.666667 C206.524998,273.666667 212.245832,266.108334 212.587498,255.154167 L212.587498,255.154167 L212.587498,255.154167 Z M226.758332,288.150001 L210.612498,288.150001 L210.983332,280.475001 C206.058332,286.541668 199.487498,289.425001 190.558332,289.425001 C179.995832,289.425001 172.754165,281.175001 172.754165,269.195834 C172.754165,251.170834 185.349998,240.654167 206.970832,240.654167 C209.179165,240.654167 212.012498,240.854167 214.912498,241.225001 C215.516665,238.783334 215.674998,237.7375 215.674998,236.425 C215.674998,231.516667 212.279165,229.6875 203.174998,229.6875 C193.641665,229.579167 185.779165,231.958334 182.549998,233.020834 C182.754165,231.791667 185.249998,216.3625 185.249998,216.3625 C194.962498,213.516667 201.366665,212.445834 208.574998,212.445834 C225.308332,212.445834 234.170832,219.958334 234.154165,234.158334 C234.187499,237.9625 233.558332,242.658334 232.574999,248.829167 C230.883332,259.558334 227.254165,282.545834 226.758332,288.150001 L226.758332,288.150001 L226.758332,288.150001 Z" id="Fill-4" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M164.599998,288.150001 L145.112498,288.150001 L156.274998,218.154167 L131.349998,288.150001 L118.070831,288.150001 L116.429164,218.554167 L104.695831,288.150001 L86.4541641,288.150001 L101.691664,197.095833 L129.712498,197.095833 L131.412498,248.062501 L148.504165,197.095833 L179.670832,197.095833 L164.599998,288.150001" id="Fill-5" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M519.575001,255.154167 C517.537501,254.916667 516.633334,254.854167 515.233334,254.854167 C504.191667,254.854167 498.600001,258.641667 498.600001,266.120834 C498.600001,270.733334 501.325001,273.666667 505.583334,273.666667 C513.520834,273.666667 519.245834,266.108334 519.575001,255.154167 L519.575001,255.154167 L519.575001,255.154167 Z M533.758334,288.150001 L517.612501,288.150001 L517.979168,280.475001 C513.054168,286.541668 506.479167,289.425001 497.558334,289.425001 C486.991667,289.425001 479.758334,281.175001 479.758334,269.195834 C479.758334,251.170834 492.345834,240.654167 513.970834,240.654167 C516.179168,240.654167 519.008334,240.854167 521.904168,241.225001 C522.508334,238.783334 522.666668,237.7375 522.666668,236.425 C522.666668,231.516667 519.275001,229.6875 510.170834,229.6875 C500.637501,229.579167 492.783334,231.958334 489.541667,233.020834 C489.745834,231.791667 492.250001,216.3625 492.250001,216.3625 C501.962501,213.516667 508.362501,212.445834 515.562501,212.445834 C532.304168,212.445834 541.166668,219.958334 541.150001,234.158334 C541.183334,237.9625 540.554168,242.658334 539.570834,248.829167 C537.887501,259.558334 534.250001,282.545834 533.758334,288.150001 L533.758334,288.150001 L533.758334,288.150001 Z" id="Fill-6" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M313.366666,287.025001 C308.033333,288.704168 303.874999,289.425001 299.366666,289.425001 C289.404166,289.425001 283.966666,283.700001 283.966666,273.158334 C283.824999,269.887501 285.399999,261.279167 286.637499,253.420834 C287.762499,246.504167 295.087499,202.891667 295.087499,202.891667 L314.458333,202.891667 L312.195833,214.1 L323.895833,214.1 L321.254166,231.895834 L309.512499,231.895834 C307.262499,245.979167 304.058333,263.520834 304.020833,265.845834 C304.020833,269.662501 306.058333,271.329167 310.691666,271.329167 C312.912499,271.329167 314.633333,271.104167 315.945833,270.629167 L313.366666,287.025001" id="Fill-7" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M372.758333,286.425001 C366.104166,288.458334 359.683333,289.441668 352.879166,289.425001 C331.195833,289.404168 319.891666,278.079167 319.891666,256.391667 C319.891666,231.079167 334.270833,212.445834 353.791666,212.445834 C369.7625,212.445834 379.9625,222.879167 379.9625,239.241667 C379.9625,244.670834 379.2625,249.970834 377.575,257.454167 L338.999999,257.454167 C337.695833,268.195834 344.570833,272.670834 355.8375,272.670834 C362.770833,272.670834 369.025,271.241667 375.979166,268.008334 L372.758333,286.425001 L372.758333,286.425001 Z M361.870833,242.525001 C361.979166,240.983334 363.925,229.308334 352.858333,229.308334 C346.6875,229.308334 342.274999,234.0125 340.479166,242.525001 L361.870833,242.525001 L361.870833,242.525001 Z" id="Fill-8" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M238.445832,237.508334 C238.445832,246.875001 242.987499,253.333334 253.287499,258.183334 C261.179166,261.891667 262.399999,262.991667 262.399999,266.354167 C262.399999,270.970834 258.920832,273.054167 251.208332,273.054167 C245.395832,273.054167 239.987499,272.145834 233.749999,270.133334 C233.749999,270.133334 231.187499,286.454168 231.070832,287.233334 C235.499999,288.200001 239.449999,289.095834 251.349999,289.425001 C271.912499,289.425001 281.408332,281.595834 281.408332,264.675001 C281.408332,254.500001 277.433332,248.529167 267.670832,244.041667 C259.499999,240.291667 258.562499,239.454167 258.562499,235.995834 C258.562499,231.991667 261.799999,229.95 268.099999,229.95 C271.924999,229.95 277.149999,230.358334 282.099999,231.0625 L284.874999,213.8875 C279.829166,213.0875 272.179166,212.445834 267.724999,212.445834 C245.924999,212.445834 238.379165,223.833334 238.445832,237.508334" id="Fill-9" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M467.533334,214.391667 C472.945834,214.391667 477.991667,215.8125 484.945834,219.3125 L488.133334,199.55 C485.279167,198.429167 475.229167,191.85 466.716667,191.85 C453.675,191.85 442.65,198.320834 434.895834,209 C423.5875,205.254167 418.9375,212.825 413.2375,220.366667 L408.175,221.545834 C408.558333,219.0625 408.904167,216.595834 408.7875,214.1 L390.891667,214.1 C388.445833,237.016667 384.1125,260.229167 380.720833,283.175001 L379.8375,288.150001 L399.333333,288.150001 C402.5875,267.008334 404.370833,253.470834 405.454167,244.308334 L412.795833,240.225001 C413.891667,236.145834 417.325,234.766667 424.2125,234.933334 C423.3125,239.766667 422.829167,244.850001 422.829167,250.116667 C422.829167,274.341667 435.9,289.425001 456.879167,289.425001 C462.283334,289.425001 466.920834,288.712501 474.100001,286.766668 L477.529167,266.008334 C471.070834,269.187501 465.770834,270.683334 460.970834,270.683334 C449.641667,270.683334 442.7875,262.320834 442.7875,248.500001 C442.7875,228.45 452.983334,214.391667 467.533334,214.391667" id="Fill-10" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M170.208331,282.741668 L150.716665,282.741668 L161.887498,212.754167 L136.962498,282.741668 L123.679164,282.741668 L122.037498,213.154167 L110.304164,282.741668 L92.0624975,282.741668 L107.299998,191.7 L135.320831,191.7 L136.108331,248.062501 L155.012498,191.7 L185.279165,191.7 L170.208331,282.741668" id="Fill-12" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M632.520835,197.095833 L628.200002,223.404167 C622.870835,216.391667 617.145835,211.316667 609.587502,211.316667 C599.754168,211.316667 590.804168,218.770834 584.945835,229.741667 C576.787501,228.05 568.350001,225.179167 568.350001,225.179167 L568.345835,225.245834 C569.004168,219.1125 569.266668,215.370834 569.208335,214.1 L551.308334,214.1 C548.870834,237.016667 544.537501,260.229167 541.150001,283.175001 L540.258334,288.150001 L559.750001,288.150001 C562.383335,271.054167 564.400001,256.858334 565.883335,245.600001 C572.541668,239.583334 575.875001,234.333334 582.604168,234.683334 C579.625001,241.887501 577.879168,250.187501 577.879168,258.700001 C577.879168,277.212501 587.245835,289.425001 601.412502,289.425001 C608.554168,289.425001 614.033335,286.962501 619.379168,281.254168 L618.466668,288.137501 L636.900002,288.137501 L651.741669,197.095833 L632.520835,197.095833 L632.520835,197.095833 Z M608.150002,271.037501 C601.516668,271.037501 598.166668,266.129167 598.166668,256.441667 C598.166668,241.887501 604.437502,231.566667 613.279168,231.566667 C619.975002,231.566667 623.600002,236.670834 623.600002,246.075001 C623.600002,260.754167 617.229168,271.037501 608.150002,271.037501 L608.150002,271.037501 L608.150002,271.037501 Z" id="Fill-11" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M218.191665,249.758334 C216.149998,249.520834 215.245832,249.458334 213.845832,249.458334 C202.799998,249.458334 197.212498,253.245834 197.212498,260.725001 C197.212498,265.329167 199.941665,268.270834 204.191665,268.270834 C212.137498,268.270834 217.858332,260.712501 218.191665,249.758334 L218.191665,249.758334 L218.191665,249.758334 Z M232.370832,282.741668 L216.224998,282.741668 L216.591665,275.079167 C211.670832,281.133334 205.091665,284.029168 196.170832,284.029168 C185.604165,284.029168 178.366665,275.779167 178.366665,263.800001 C178.366665,245.766667 190.958332,235.258334 212.583332,235.258334 C214.791665,235.258334 217.624998,235.458334 220.520832,235.829167 C221.124999,233.3875 221.283332,232.341667 221.283332,231.020834 C221.283332,226.1125 217.891665,224.291667 208.787498,224.291667 C199.249998,224.183334 191.391665,226.5625 188.158332,227.6125 C188.362498,226.3875 190.858332,210.975 190.858332,210.975 C200.566665,208.116667 206.979165,207.045834 214.179165,207.045834 C230.916665,207.045834 239.783332,214.5625 239.766665,228.75 C239.795832,232.570834 239.162499,237.2625 238.183332,243.425001 C236.495832,254.150001 232.862499,277.150001 232.370832,282.741668 L232.370832,282.741668 L232.370832,282.741668 Z" id="Fill-13" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M493.745834,194.15 L490.554167,213.916667 C483.604167,210.420834 478.554167,208.995834 473.145834,208.995834 C458.595834,208.995834 448.395834,223.054167 448.395834,243.104167 C448.395834,256.925001 455.254167,265.283334 466.579167,265.283334 C471.379167,265.283334 476.675001,263.791667 483.133334,260.608334 L479.712501,281.358334 C472.529167,283.316668 467.895834,284.029168 462.4875,284.029168 C441.5125,284.029168 428.4375,268.945834 428.4375,244.720834 C428.4375,212.170834 446.495834,189.420833 472.325001,189.420833 C480.833334,189.420833 490.887501,193.029167 493.745834,194.15" id="Fill-14" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M525.187501,249.758334 C523.145834,249.520834 522.245834,249.458334 520.841668,249.458334 C509.800001,249.458334 504.208334,253.245834 504.208334,260.725001 C504.208334,265.329167 506.937501,268.270834 511.191668,268.270834 C519.129168,268.270834 524.854168,260.712501 525.187501,249.758334 L525.187501,249.758334 L525.187501,249.758334 Z M539.366668,282.741668 L523.216668,282.741668 L523.587501,275.079167 C518.662501,281.133334 512.087501,284.029168 503.166667,284.029168 C492.604167,284.029168 485.362501,275.779167 485.362501,263.800001 C485.362501,245.766667 497.958334,235.258334 519.575001,235.258334 C521.787501,235.258334 524.616668,235.458334 527.516668,235.829167 C528.116668,233.3875 528.279168,232.341667 528.279168,231.020834 C528.279168,226.1125 524.887501,224.291667 515.783334,224.291667 C506.250001,224.183334 498.387501,226.5625 495.154167,227.6125 C495.358334,226.3875 497.858334,210.975 497.858334,210.975 C507.566667,208.116667 513.975001,207.045834 521.175001,207.045834 C537.916668,207.045834 546.779168,214.5625 546.758334,228.75 C546.791668,232.570834 546.162501,237.2625 545.179168,243.425001 C543.495834,254.150001 539.854168,277.150001 539.366668,282.741668 L539.366668,282.741668 L539.366668,282.741668 Z" id="Fill-15" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M318.974999,281.620834 C313.637499,283.300001 309.479166,284.029168 304.974999,284.029168 C295.012499,284.029168 289.574999,278.304167 289.574999,267.762501 C289.437499,264.483334 291.012499,255.883334 292.249999,248.025001 C293.370832,241.100001 300.695832,197.491667 300.695832,197.491667 L320.062499,197.491667 L317.804166,208.704167 L327.745833,208.704167 L325.099999,226.491667 L315.124999,226.491667 C312.874999,240.583334 309.662499,258.112501 309.629166,260.441667 C309.629166,264.270834 311.670833,265.925001 316.299999,265.925001 C318.520833,265.925001 320.237499,265.708334 321.554166,265.233334 L318.974999,281.620834" id="Fill-16" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M378.366666,281.029167 C371.716666,283.062501 365.2875,284.041668 358.4875,284.029168 C336.804166,284.008334 325.499999,272.683334 325.499999,250.995834 C325.499999,225.675 339.879166,207.045834 359.4,207.045834 C375.370833,207.045834 385.570833,217.475 385.570833,233.845834 C385.570833,239.279167 384.870833,244.579167 383.1875,252.058334 L344.6125,252.058334 C343.308333,262.800001 350.183333,267.279167 361.45,267.279167 C368.379166,267.279167 374.6375,265.845834 381.5875,262.604167 L378.366666,281.029167 L378.366666,281.029167 Z M367.475,237.116667 C367.591666,235.579167 369.533333,223.9 358.4625,223.9 C352.295833,223.9 347.883333,228.616667 346.0875,237.116667 L367.475,237.116667 L367.475,237.116667 Z" id="Fill-17" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M244.054165,232.1125 C244.054165,241.479167 248.595832,247.929167 258.895832,252.787501 C266.787499,256.495834 268.008332,257.600001 268.008332,260.958334 C268.008332,265.575001 264.524999,267.658334 256.820832,267.658334 C251.004165,267.658334 245.595832,266.750001 239.354165,264.737501 C239.354165,264.737501 236.799999,281.058334 236.683332,281.837501 C241.104165,282.804168 245.058332,283.687501 256.958332,284.029168 C277.524999,284.029168 287.016666,276.200001 287.016666,259.283334 C287.016666,249.104167 283.045832,243.133334 273.279166,238.645834 C265.112499,234.8875 264.166666,234.0625 264.166666,230.6 C264.166666,226.6 267.412499,224.541667 273.708332,224.541667 C277.529166,224.541667 282.754166,224.9625 287.712499,225.666667 L290.483332,208.4875 C285.441666,207.6875 277.791666,207.045834 273.337499,207.045834 C251.533332,207.045834 243.991665,218.425 244.054165,232.1125" id="Fill-18" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M642.508335,282.741668 L624.070835,282.741668 L624.987502,275.850001 C619.641668,281.566668 614.162502,284.029168 607.020835,284.029168 C592.854168,284.029168 583.491668,271.816667 583.491668,253.304167 C583.491668,228.675 598.012502,207.9125 615.200002,207.9125 C622.758335,207.9125 628.479168,211 633.804168,218.008334 L638.129169,191.7 L657.350002,191.7 L642.508335,282.741668 L642.508335,282.741668 Z M613.762502,265.633334 C622.837502,265.633334 629.212502,255.350001 629.212502,240.679167 C629.212502,231.275 625.583335,226.170834 618.887502,226.170834 C610.050002,226.170834 603.770835,236.4875 603.770835,251.045834 C603.770835,260.733334 607.129168,265.633334 613.762502,265.633334 L613.762502,265.633334 L613.762502,265.633334 Z" id="Fill-19" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M556.920835,208.704167 C554.479168,231.620834 550.145834,254.833334 546.758334,277.766667 L545.866668,282.741668 L565.358335,282.741668 C572.329168,237.466667 574.016668,228.625 584.945835,229.733334 C586.687501,220.466667 589.929168,212.35 592.345835,208.254167 C584.183335,206.554167 579.625001,211.166667 573.658335,219.929167 C574.129168,216.141667 574.991668,212.4625 574.820835,208.704167 L556.920835,208.704167" id="Fill-20" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M396.5,208.704167 C394.054167,231.620834 389.720833,254.833334 386.333333,277.766667 L385.445833,282.741668 L404.945833,282.741668 C411.908333,237.466667 413.591667,228.625 424.516667,229.733334 C426.266667,220.466667 429.508334,212.35 431.916667,208.254167 C423.7625,206.554167 419.2,211.166667 413.2375,219.929167 C413.708333,216.141667 414.5625,212.4625 414.4,208.704167 L396.5,208.704167" id="Fill-21" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<path d="M651.066669,276.945834 C651.066669,273.733334 653.662502,271.145834 656.862502,271.145834 C660.066669,271.145834 662.658335,273.733334 662.658335,276.945834 C662.658335,280.141667 660.066669,282.741668 656.862502,282.741668 C653.662502,282.741668 651.066669,280.141667 651.066669,276.945834 L651.066669,276.945834 L651.066669,276.945834 Z M656.862502,281.350001 C659.300002,281.350001 661.266669,279.375001 661.266669,276.945834 C661.266669,274.512501 659.300002,272.537501 656.862502,272.537501 C654.429169,272.537501 652.454169,274.512501 652.454169,276.945834 C652.454169,279.375001 654.429169,281.350001 656.862502,281.350001 L656.862502,281.350001 L656.862502,281.350001 Z M656.079169,279.479167 L654.891669,279.479167 L654.891669,274.395834 L657.045835,274.395834 C657.491669,274.395834 657.954169,274.404167 658.341669,274.650001 C658.758335,274.933334 658.995835,275.416667 658.995835,275.925001 C658.995835,276.500001 658.658335,277.037501 658.108335,277.241667 L659.050002,279.479167 L657.729169,279.479167 L656.950002,277.470834 L656.079169,277.470834 L656.079169,279.479167 L656.079169,279.479167 Z M656.079169,276.600001 L656.733335,276.600001 C656.979169,276.600001 657.245835,276.616667 657.462502,276.500001 C657.658335,276.375001 657.758335,276.137501 657.758335,275.912501 C657.758335,275.725001 657.641669,275.500001 657.470835,275.387501 C657.266669,275.270834 656.929169,275.304167 656.708335,275.304167 L656.079169,275.304167 L656.079169,276.600001 L656.079169,276.600001 Z" id="Fill-22" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="mastercard">
<rect id="Rectangle-1" fill="#F4F4F4" x="0" y="0" width="750" height="471" rx="40"></rect>
<g id="mark" transform="translate(125.719997, 41.850862)">
<g id="text" transform="translate(25.142679, 328.360022)" fill="#000000">
<path d="M467.715561,51.9326899 C466.502604,51.9623585 465.503405,52.3648948 464.717962,53.1403001 C463.932516,53.9157321 463.526027,54.8861098 463.498494,56.0514362 C463.526027,57.2079497 463.932516,58.1758036 464.717963,58.9550005 C465.503406,59.7342125 466.502604,60.1392726 467.715561,60.1701825 C468.900764,60.1392726 469.887352,59.7342123 470.675326,58.9550002 C471.463285,58.175803 471.872297,57.2079493 471.902362,56.0514362 C471.872927,54.8861098 471.465177,53.915732 470.679109,53.1402998 C469.893026,52.3648943 468.905178,51.9623581 467.715561,51.9326899 L467.715561,51.9326899 L467.715561,51.9326899 Z M467.715561,59.2616355 C466.791392,59.2389292 466.029277,58.9259854 465.429214,58.3228033 C464.829145,57.7196374 464.518499,56.9625159 464.497273,56.0514362 C464.518499,55.1363804 464.829146,54.379679 465.429214,53.78133 C466.029277,53.1830062 466.791392,52.8730071 467.715561,52.8513318 C468.620383,52.8730076 469.370728,53.1830066 469.966597,53.7813302 C470.562452,54.379679 470.871417,55.1363804 470.893494,56.0514362 C470.871417,56.9625161 470.562452,57.7196378 469.966597,58.3228033 C469.370728,58.925985 468.620384,59.2389287 467.715561,59.2616355 L467.715561,59.2616355 L467.715561,59.2616355 Z M467.957689,54.1232975 L466.19217,54.1232975 L466.19217,57.9492899 L467.009353,57.9492899 L467.009353,56.5158046 L467.382634,56.5158046 L468.542832,57.9492899 L469.521434,57.9492899 L468.270438,56.5057097 C468.661158,56.4567169 468.961716,56.330109 469.172113,56.1258861 C469.382498,55.9216836 469.488849,55.6613181 469.491168,55.3447885 C469.488429,54.9670796 469.355174,54.6701195 469.091404,54.4539073 C468.827621,54.237719 468.449717,54.1275158 467.957689,54.1232975 L467.957689,54.1232975 L467.957689,54.1232975 Z M467.9476,54.8400402 C468.166813,54.840262 468.338741,54.8827453 468.463383,54.9674885 C468.588015,55.0522552 468.651489,55.1780218 468.653808,55.3447882 C468.651483,55.5164129 468.588015,55.6451235 468.463383,55.73092 C468.338741,55.8167385 468.166813,55.8596412 467.9476,55.859631 L467.009353,55.859631 L467.009353,54.8400393 L467.9476,54.8400402 L467.9476,54.8400402 Z" id="path3078"></path>
<path d="M9.34331724,57.5428029 L0.588175916,57.5428029 L0.588175916,16.6600045 L9.17164757,16.6600045 L9.17164757,21.6415186 C9.17164757,21.6415186 16.7107355,15.5532485 21.1885083,15.6293508 C29.8949298,15.7773317 35.093729,23.1875098 35.093729,23.1875098 C35.093729,23.1875098 39.3109893,15.6293508 48.8272918,15.6293508 C62.8997988,15.6293508 64.9642149,28.5125858 64.9642149,28.5125858 L64.9642149,57.3710273 L56.5524108,57.3710273 L56.5524108,31.9481087 C56.5524108,31.9481087 56.5825922,24.2181741 47.4539323,24.2181741 C38.0139747,24.2181741 37.1537629,31.9481087 37.1537629,31.9481087 L37.1537629,57.3710273 L28.3986215,57.3710273 L28.3986215,31.7763331 C28.3986215,31.7763331 27.5575496,23.7028366 19.6434834,23.7028366 C9.3650113,23.7028366 9.17164757,31.9481087 9.17164757,31.9481087 L9.34331724,57.5428029 L9.34331724,57.5428029 Z" id="path3006"></path>
<path d="M275.596898,15.623773 C271.119122,15.5476814 263.580741,21.6355967 263.580741,21.6355967 L263.580741,16.6649268 L254.988182,16.6649268 L254.988182,57.5386115 L263.748565,57.5386115 L263.580741,31.9463783 C263.580741,31.9463783 263.77445,23.7179044 274.052923,23.7179044 C275.961824,23.7179044 277.444363,24.180569 278.61772,24.8934007 L278.61772,24.8598688 L281.470718,16.9000798 C279.749092,16.1750176 277.791223,15.6610664 275.596898,15.623773 L275.596898,15.623773 L275.596898,15.623773 Z" id="path3008"></path>
<path d="M398.92774,15.623773 C394.449964,15.5476814 386.911582,21.6355967 386.911582,21.6355967 L386.911582,16.6649268 L378.319023,16.6649268 L378.319023,57.5386115 L387.079406,57.5386115 L386.911582,31.9463783 C386.911582,31.9463783 387.105291,23.7179044 397.383764,23.7179044 C399.292666,23.7179044 400.775204,24.180569 401.948561,24.8934007 L401.948561,24.8598688 L404.801559,16.9000798 C403.079933,16.1750713 401.122064,15.6611201 398.92774,15.6238267 L398.92774,15.623773 L398.92774,15.623773 Z" id="path3013"></path>
<path d="M93.2735295,15.4558449 C80.1708646,15.4558449 73.2368626,27.2396859 73.2018479,37.0849763 C73.1658666,47.1762746 81.0955959,58.8148646 93.6427411,58.8148646 C100.962678,58.8148646 106.976041,53.4075817 106.976041,53.4075817 L106.960145,57.5721971 L115.577998,57.5721971 L115.577998,16.6488272 L106.929792,16.6488272 L106.929792,21.8035248 C106.929792,21.8035248 101.282654,15.4558449 93.2735725,15.4558449 L93.2735295,15.4558449 L93.2735295,15.4558449 Z M94.9517638,23.7850756 C101.991433,23.7850756 107.706344,29.9122942 107.706344,37.454418 C107.706344,44.9965418 101.991433,51.0901748 94.9517638,51.0901748 C87.9120947,51.0901748 82.2307482,44.9965418 82.2307482,37.454418 C82.2307482,29.9122942 87.9120947,23.7850756 94.9517638,23.7850756 L94.9517638,23.7850756 L94.9517638,23.7850756 Z" id="path3015"></path>
<path d="M344.597578,15.4558449 C331.494913,15.4558449 324.560911,27.2396859 324.525896,37.0849763 C324.489915,47.1762746 332.419644,58.8148646 344.966789,58.8148646 C352.286726,58.8148646 358.300089,53.4075817 358.300089,53.4075817 L358.284193,57.5721971 L366.902046,57.5721971 L366.902046,16.6488272 L358.25384,16.6488272 L358.25384,21.8035248 C358.25384,21.8035248 352.606702,15.4558449 344.59762,15.4558449 L344.597578,15.4558449 L344.597578,15.4558449 Z M346.275812,23.7850756 C353.315481,23.7850756 359.030392,29.9122942 359.030392,37.454418 C359.030392,44.9965418 353.315481,51.0901748 346.275812,51.0901748 C339.236143,51.0901748 333.554796,44.9965418 333.554796,37.454418 C333.554796,29.9122942 339.236143,23.7850756 346.275812,23.7850756 L346.275812,23.7850756 L346.275812,23.7850756 Z" id="path3020"></path>
<path d="M427.342249,15.4558449 C414.239584,15.4558449 407.305582,27.2396859 407.270567,37.0849763 C407.234586,47.1762746 415.164315,58.8148646 427.71146,58.8148646 C435.031397,58.8148646 441.04476,53.4075817 441.04476,53.4075817 L441.028864,57.5721971 L449.646718,57.5721971 L449.646718,0.49407462 L440.998511,0.49407462 L440.998511,21.8035248 C440.998511,21.8035248 435.351373,15.4558449 427.342292,15.4558449 L427.342249,15.4558449 L427.342249,15.4558449 Z M429.020483,23.7850756 C436.060152,23.7850756 441.775063,29.9122942 441.775063,37.454418 C441.775063,44.9965418 436.060152,51.0901748 429.020483,51.0901748 C421.980814,51.0901748 416.299467,44.9965418 416.299467,37.454418 C416.299467,29.9122942 421.980814,23.7850756 429.020483,23.7850756 L429.020483,23.7850756 L429.020483,23.7850756 Z" id="path3022"></path>
<path d="M141.872122,58.9170078 C132.94558,58.9170078 124.705176,53.4201669 124.705176,53.4201669 L128.481907,47.5797641 C128.481907,47.5797641 136.278978,51.1870733 141.872122,51.1870733 C145.50613,51.1870733 151.583937,50.0128667 151.657274,46.3773348 C151.734822,42.5349478 141.442945,41.39581 141.442945,41.39581 C141.442945,41.39581 126.078536,41.1860853 126.078536,28.5125858 C126.078536,20.5421246 133.751938,15.4575752 143.588818,15.4575752 C149.272667,15.4575752 159.89741,20.4390893 159.89741,20.4390893 L155.605674,27.1383702 C155.605674,27.1383702 147.402218,23.858921 143.073802,23.7028366 C139.418806,23.5710413 135.005346,25.3221465 135.005346,28.5125858 C135.005346,37.1806926 160.584084,27.837198 160.584084,45.3466704 C160.584084,56.8338188 150.166691,58.9170078 141.872122,58.9170078 L141.872122,58.9170078 L141.872122,58.9170078 Z" id="path3024"></path>
<path d="M174.802149,4.80920724 L174.802149,16.6985124 L167.182966,16.6985124 L167.182966,25.296428 L174.802149,25.296428 L174.802149,45.85082 C174.802149,45.85082 174.127827,59.7552616 189.067141,59.7552616 C193.19753,59.7552616 201.284686,56.6989713 201.284686,56.6989713 L197.827523,47.7651996 C197.827523,47.7651996 194.611468,50.5102454 190.980328,50.4184626 C184.076195,50.2440217 184.267391,45.8172343 184.267391,45.8172343 L184.267391,25.296428 L198.498817,25.296428 L198.498817,16.6985124 L184.267391,16.6985124 L184.267391,4.80920724 L174.802149,4.80920724 L174.802149,4.80920724 L174.802149,4.80920724 Z" id="path3026"></path>
<path d="M226.659588,15.959629 C212.610087,15.959629 205.590417,27.5389793 205.648095,37.5887604 C205.707384,47.9238419 212.040304,59.5537479 227.498705,59.5537479 C234.115072,59.5537479 243.408366,53.7434378 243.408366,53.7434378 L239.414168,46.791217 C239.414168,46.791217 233.072548,51.2916884 227.498705,51.2916884 C216.339172,51.2916884 215.616806,40.3763659 215.616806,40.3763659 L245.489376,40.3763659 C245.489376,40.3763659 247.717985,15.959629 226.659588,15.959629 L226.659588,15.959629 L226.659588,15.959629 Z M225.38413,23.9865893 C225.715416,23.9677813 226.070568,23.9865893 226.424635,23.9865893 C236.937954,23.9865893 236.863252,33.9279292 236.863252,33.9279292 L215.616806,33.9279292 C215.616806,33.9279292 215.114206,24.5707962 225.38413,23.9865893 L225.38413,23.9865893 L225.38413,23.9865893 Z" id="path3034"></path>
<path d="M315.5162,46.686 L319.52203,54.7026427 C319.52203,54.7026427 313.17302,58.8324258 306.047898,58.8324258 C291.296557,58.8324258 283.105442,47.7234997 283.105442,37.2117848 C283.105442,20.6912339 296.140698,15.8340672 304.955397,15.8340672 C312.956369,15.8340672 319.886193,20.4497077 319.886193,20.4497077 L315.394819,28.4663505 C315.394819,28.4663505 312.671859,24.2151004 304.712614,24.2151004 C296.766655,24.2151004 292.573755,31.0702185 292.573755,37.5761752 C292.573755,44.8669927 297.454114,51.0587064 304.834005,51.0587064 C310.623393,51.0587064 315.5162,46.686 315.5162,46.686 L315.5162,46.686 L315.5162,46.686 Z" id="path3037"></path>
</g>
<path d="M498.787985,236.781279 L498.787985,231.260623 L497.347484,231.260623 L495.690436,235.057252 L494.033388,231.260623 L492.592886,231.260623 L492.592886,236.781279 L493.609711,236.781279 L493.609711,232.617235 L495.163193,236.206603 L496.217678,236.206603 L497.771161,232.607814 L497.771161,236.781279 L498.787985,236.781279 L498.787985,236.781279 Z M489.664807,236.781279 L489.664807,232.202715 L491.510156,232.202715 L491.510156,231.270044 L486.812049,231.270044 L486.812049,232.202715 L488.657397,232.202715 L488.657397,236.781279 L489.664807,236.781279 L489.664807,236.781279 Z" id="path3057" fill="#F79F1A"></path>
<path d="M499.076678,154.709802 C499.076678,240.135159 429.999707,309.386105 344.788929,309.386105 C259.578151,309.386105 190.501159,240.135159 190.501159,154.709802 C190.501159,69.2844326 259.578151,0.0334920174 344.788929,0.0334920174 C429.999707,0.0334920174 499.076678,69.2844326 499.076678,154.709802 L499.076678,154.709802 L499.076678,154.709802 Z" id="path2997" fill="#F79F1A"></path>
<path d="M308.73932,154.709802 C308.73932,240.135159 239.662349,309.386105 154.451571,309.386105 C69.2407931,309.386105 0.163801275,240.135159 0.163801275,154.709802 C0.163801275,69.2844326 69.2407931,0.0334920174 154.451571,0.0334920174 C239.662349,0.0334920174 308.73932,69.2844326 308.73932,154.709802 L308.73932,154.709802 L308.73932,154.709802 Z" id="path2995" fill="#EA001B"></path>
<path d="M249.620562,32.9474812 C213.621326,61.2636823 190.513152,105.265345 190.513152,154.695309 C190.513152,204.125274 213.621326,248.16052 249.620562,276.476723 C285.619799,248.16052 308.727973,204.125274 308.727973,154.695309 C308.727973,105.265345 285.619799,61.2636823 249.620562,32.9474812 L249.620562,32.9474812 L249.620562,32.9474812 Z" id="path2999" fill="#FF5F01"></path>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -70,9 +70,10 @@ jQuery( function( $ ) {
// Error message collection
var $error = $( '.woocommerce-error', $html );
var $message = $( '.woocommerce-message', $html );
var $info = $( '.woocommerce-info', $html );
// Remove errors
$( '.woocommerce-error, .woocommerce-message' ).remove();
$( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();
if ( $new_form.length === 0 ) {
// If the checkout is also displayed on this page, trigger reload instead.
@ -88,9 +89,13 @@ jQuery( function( $ ) {
// Display errors
if ( $error.length > 0 ) {
show_notice( $error, $( '.cart-empty' ).closest( '.woocommerce' ) );
} else if ( $message.length > 0 ) {
}
if ( $message.length > 0 ) {
show_notice( $message, $( '.cart-empty' ).closest( '.woocommerce' ) );
}
if ( $info.length > 0 ) {
show_notice( $info, $( '.cart-empty' ).closest( '.woocommerce' ) );
}
} else {
// If the checkout is also displayed on this page, trigger update event.
if ( $( '.woocommerce-checkout' ).length ) {
@ -102,9 +107,13 @@ jQuery( function( $ ) {
if ( $error.length > 0 ) {
show_notice( $error );
} else if ( $message.length > 0 ) {
}
if ( $message.length > 0 ) {
show_notice( $message );
}
if ( $info.length > 0 ) {
show_notice( $info );
}
update_cart_totals_div( $new_totals );
}
@ -131,7 +140,7 @@ jQuery( function( $ ) {
if ( ! $target ) {
$target = $( '.shop_table.cart' ).closest( 'form' );
}
$( '.woocommerce-error, .woocommerce-message' ).remove();
$( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();
$target.before( html_element );
};

File diff suppressed because one or more lines are too long

View File

@ -15,10 +15,10 @@ return array(
'state' => '',
'rate' => '10.0000',
'name' => 'GST',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'BD' => array(
'currency_code' => 'BDT',
@ -35,10 +35,10 @@ return array(
'state' => '',
'rate' => '15.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'BE' => array(
'currency_code' => 'EUR',
@ -55,10 +55,10 @@ return array(
'state' => '',
'rate' => '20.0000',
'name' => 'BTW',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'BR' => array(
'currency_code' => 'BRL',
@ -68,7 +68,7 @@ return array(
'num_decimals' => 2,
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
'tax_rates' => array()
'tax_rates' => array(),
),
'CA' => array(
'currency_code' => 'CAD',
@ -86,8 +86,8 @@ return array(
'rate' => '7.0000',
'name' => _x( 'PST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => false,
'priority' => 2
)
'priority' => 2,
),
),
'SK' => array(
array(
@ -96,8 +96,8 @@ return array(
'rate' => '5.0000',
'name' => _x( 'PST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => false,
'priority' => 2
)
'priority' => 2,
),
),
'MB' => array(
array(
@ -106,8 +106,8 @@ return array(
'rate' => '8.0000',
'name' => _x( 'PST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => false,
'priority' => 2
)
'priority' => 2,
),
),
'QC' => array(
array(
@ -116,8 +116,8 @@ return array(
'rate' => '9.975',
'name' => _x( 'QST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => false,
'priority' => 2
)
'priority' => 2,
),
),
'*' => array(
array(
@ -125,94 +125,94 @@ return array(
'state' => 'ON',
'rate' => '13.0000',
'name' => _x( 'HST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'NL',
'rate' => '13.0000',
'name' => _x( 'HST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'NB',
'rate' => '13.0000',
'name' => _x( 'HST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'PE',
'rate' => '14.0000',
'name' => _x( 'HST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'NS',
'rate' => '15.0000',
'name' => _x( 'HST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'AB',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'BC',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'NT',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'NU',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'YT',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'SK',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'MB',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
'shipping' => true,
),
array(
'country' => 'CA',
'state' => 'QC',
'rate' => '5.0000',
'name' => _x( 'GST', 'Canadian Tax Rates', 'woocommerce' ),
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'DE' => array(
'currency_code' => 'EUR',
@ -229,10 +229,10 @@ return array(
'state' => '',
'rate' => '19.0000',
'name' => 'Mwst.',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'ES' => array(
'currency_code' => 'EUR',
@ -249,10 +249,10 @@ return array(
'state' => '',
'rate' => '21.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'FR' => array(
'currency_code' => 'EUR',
@ -269,10 +269,10 @@ return array(
'state' => '',
'rate' => '20.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'GB' => array(
'currency_code' => 'GBP',
@ -289,10 +289,10 @@ return array(
'state' => '',
'rate' => '20.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'HU' => array(
'currency_code' => 'HUF',
@ -309,10 +309,10 @@ return array(
'state' => '',
'rate' => '27.0000',
'name' => 'ÁFA',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'IT' => array(
'currency_code' => 'EUR',
@ -329,10 +329,10 @@ return array(
'state' => '',
'rate' => '22.0000',
'name' => 'IVA',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'JP' => array(
'currency_code' => 'JPY',
@ -349,10 +349,10 @@ return array(
'state' => '',
'rate' => '8.0000',
'name' => __( 'Consumption tax', 'woocommerce' ),
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'NL' => array(
'currency_code' => 'EUR',
@ -369,10 +369,10 @@ return array(
'state' => '',
'rate' => '21.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'NO' => array(
'currency_code' => 'Kr',
@ -389,10 +389,10 @@ return array(
'state' => '',
'rate' => '25.0000',
'name' => 'MVA',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'NP' => array(
'currency_code' => 'NPR',
@ -409,10 +409,10 @@ return array(
'state' => '',
'rate' => '13.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'PL' => array(
'currency_code' => 'PLN',
@ -429,10 +429,10 @@ return array(
'state' => '',
'rate' => '23.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'TH' => array(
'currency_code' => 'THB',
@ -449,10 +449,10 @@ return array(
'state' => '',
'rate' => '7.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'TR' => array(
'currency_code' => 'TRY',
@ -469,10 +469,10 @@ return array(
'state' => '',
'rate' => '18.0000',
'name' => 'KDV',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'US' => array(
'currency_code' => 'USD',
@ -489,8 +489,8 @@ return array(
'state' => 'AL',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'AZ' => array(
array(
@ -498,8 +498,8 @@ return array(
'state' => 'AZ',
'rate' => '5.6000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'AR' => array(
array(
@ -507,8 +507,8 @@ return array(
'state' => 'AR',
'rate' => '6.5000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'CA' => array(
array(
@ -516,8 +516,8 @@ return array(
'state' => 'CA',
'rate' => '7.5000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'CO' => array(
array(
@ -525,8 +525,8 @@ return array(
'state' => 'CO',
'rate' => '2.9000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'CT' => array(
array(
@ -534,8 +534,8 @@ return array(
'state' => 'CT',
'rate' => '6.3500',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'DC' => array(
array(
@ -543,8 +543,8 @@ return array(
'state' => 'DC',
'rate' => '5.7500',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'FL' => array(
array(
@ -552,8 +552,8 @@ return array(
'state' => 'FL',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'GA' => array(
array(
@ -561,8 +561,8 @@ return array(
'state' => 'GA',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'GU' => array(
array(
@ -570,8 +570,8 @@ return array(
'state' => 'GU',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'HI' => array(
array(
@ -579,8 +579,8 @@ return array(
'state' => 'HI',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'ID' => array(
array(
@ -588,8 +588,8 @@ return array(
'state' => 'ID',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'IL' => array(
array(
@ -597,8 +597,8 @@ return array(
'state' => 'IL',
'rate' => '6.2500',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'IN' => array(
array(
@ -606,8 +606,8 @@ return array(
'state' => 'IN',
'rate' => '7.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'IA' => array(
array(
@ -615,8 +615,8 @@ return array(
'state' => 'IA',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'KS' => array(
array(
@ -624,8 +624,8 @@ return array(
'state' => 'KS',
'rate' => '6.1500',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'KY' => array(
array(
@ -633,8 +633,8 @@ return array(
'state' => 'KY',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'LA' => array(
array(
@ -642,8 +642,8 @@ return array(
'state' => 'LA',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'ME' => array(
array(
@ -651,8 +651,8 @@ return array(
'state' => 'ME',
'rate' => '5.5000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'MD' => array(
array(
@ -660,8 +660,8 @@ return array(
'state' => 'MD',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'MA' => array(
array(
@ -669,8 +669,8 @@ return array(
'state' => 'MA',
'rate' => '6.2500',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'MI' => array(
array(
@ -678,8 +678,8 @@ return array(
'state' => 'MI',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'MN' => array(
array(
@ -687,8 +687,8 @@ return array(
'state' => 'MN',
'rate' => '6.8750',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'MS' => array(
array(
@ -696,8 +696,8 @@ return array(
'state' => 'MS',
'rate' => '7.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'MO' => array(
array(
@ -705,8 +705,8 @@ return array(
'state' => 'MO',
'rate' => '4.225',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'NE' => array(
array(
@ -714,8 +714,8 @@ return array(
'state' => 'NE',
'rate' => '5.5000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'NV' => array(
array(
@ -723,8 +723,8 @@ return array(
'state' => 'NV',
'rate' => '6.8500',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'NJ' => array(
array(
@ -732,8 +732,8 @@ return array(
'state' => 'NJ',
'rate' => '7.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'NM' => array(
array(
@ -741,8 +741,8 @@ return array(
'state' => 'NM',
'rate' => '5.1250',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'NY' => array(
array(
@ -750,8 +750,8 @@ return array(
'state' => 'NY',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'NC' => array(
array(
@ -759,8 +759,8 @@ return array(
'state' => 'NC',
'rate' => '4.7500',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'ND' => array(
array(
@ -768,8 +768,8 @@ return array(
'state' => 'ND',
'rate' => '5.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'OH' => array(
array(
@ -777,8 +777,8 @@ return array(
'state' => 'OH',
'rate' => '5.7500',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'OK' => array(
array(
@ -786,8 +786,8 @@ return array(
'state' => 'OK',
'rate' => '4.5000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'PA' => array(
array(
@ -795,8 +795,8 @@ return array(
'state' => 'PA',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'PR' => array(
array(
@ -804,8 +804,8 @@ return array(
'state' => 'PR',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'RI' => array(
array(
@ -813,8 +813,8 @@ return array(
'state' => 'RI',
'rate' => '7.0000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'SC' => array(
array(
@ -822,8 +822,8 @@ return array(
'state' => 'SC',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'SD' => array(
array(
@ -831,8 +831,8 @@ return array(
'state' => 'SD',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'TN' => array(
array(
@ -840,8 +840,8 @@ return array(
'state' => 'TN',
'rate' => '7.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'TX' => array(
array(
@ -849,8 +849,8 @@ return array(
'state' => 'TX',
'rate' => '6.2500',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'UT' => array(
array(
@ -858,8 +858,8 @@ return array(
'state' => 'UT',
'rate' => '5.9500',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'VT' => array(
array(
@ -867,8 +867,8 @@ return array(
'state' => 'VT',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'VA' => array(
array(
@ -876,8 +876,8 @@ return array(
'state' => 'VA',
'rate' => '5.3000',
'name' => 'State Tax',
'shipping' => false
)
'shipping' => false,
),
),
'WA' => array(
array(
@ -885,8 +885,8 @@ return array(
'state' => 'WA',
'rate' => '6.5000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'WV' => array(
array(
@ -894,8 +894,8 @@ return array(
'state' => 'WV',
'rate' => '6.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'WI' => array(
array(
@ -903,8 +903,8 @@ return array(
'state' => 'WI',
'rate' => '5.0000',
'name' => 'State Tax',
'shipping' => true
)
'shipping' => true,
),
),
'WY' => array(
array(
@ -912,10 +912,10 @@ return array(
'state' => 'WY',
'rate' => '4.0000',
'name' => 'State Tax',
'shipping' => true
)
)
)
'shipping' => true,
),
),
),
),
'ZA' => array(
'currency_code' => 'ZAR',
@ -932,9 +932,9 @@ return array(
'state' => '',
'rate' => '14.0000',
'name' => 'VAT',
'shipping' => true
)
)
)
)
'shipping' => true,
),
),
),
),
);

View File

@ -33,5 +33,5 @@ $states['AR'] = array(
'S' => __( 'Santa Fe', 'woocommerce' ),
'G' => __( 'Santiago del Estero', 'woocommerce' ),
'V' => __( 'Tierra del Fuego', 'woocommerce' ),
'T' => __( 'Tucum&aacute;n', 'woocommerce' )
'T' => __( 'Tucum&aacute;n', 'woocommerce' ),
);

View File

@ -17,5 +17,5 @@ $states['AU'] = array(
'SA' => __( 'South Australia', 'woocommerce' ),
'TAS' => __( 'Tasmania', 'woocommerce' ),
'VIC' => __( 'Victoria', 'woocommerce' ),
'WA' => __( 'Western Australia', 'woocommerce' )
'WA' => __( 'Western Australia', 'woocommerce' ),
);

View File

@ -73,5 +73,5 @@ $states['BD'] = array(
'SUN' => __( 'Sunamganj', 'woocommerce' ),
'SYL' => __( 'Sylhet', 'woocommerce' ),
'TAN' => __( 'Tangail', 'woocommerce' ),
'THA' => __( 'Thakurgaon', 'woocommerce' )
'THA' => __( 'Thakurgaon', 'woocommerce' ),
);

View File

@ -36,5 +36,5 @@ $states['BR'] = array(
'SC' => __( 'Santa Catarina', 'woocommerce' ),
'SP' => __( 'S&atilde;o Paulo', 'woocommerce' ),
'SE' => __( 'Sergipe', 'woocommerce' ),
'TO' => __( 'Tocantins', 'woocommerce' )
'TO' => __( 'Tocantins', 'woocommerce' ),
);

View File

@ -22,5 +22,5 @@ $states['CA'] = array(
'PE' => __( 'Prince Edward Island', 'woocommerce' ),
'QC' => __( 'Quebec', 'woocommerce' ),
'SK' => __( 'Saskatchewan', 'woocommerce' ),
'YT' => __( 'Yukon Territory', 'woocommerce' )
'YT' => __( 'Yukon Territory', 'woocommerce' ),
);

View File

@ -41,5 +41,5 @@ $states['CN'] = array(
'CN29' => __( 'Ningxia Hui / &#23425;&#22799;', 'woocommerce' ),
'CN30' => __( 'Macau / &#28595;&#38376;', 'woocommerce' ),
'CN31' => __( 'Tibet / &#35199;&#34255;', 'woocommerce' ),
'CN32' => __( 'Xinjiang / &#26032;&#30086;', 'woocommerce' )
'CN32' => __( 'Xinjiang / &#26032;&#30086;', 'woocommerce' ),
);

View File

@ -61,5 +61,5 @@ $states['ES'] = array(
'VA' => __( 'Valladolid', 'woocommerce' ),
'BI' => __( 'Bizkaia', 'woocommerce' ),
'ZA' => __( 'Zamora', 'woocommerce' ),
'Z' => __( 'Zaragoza', 'woocommerce' )
'Z' => __( 'Zaragoza', 'woocommerce' ),
);

View File

@ -22,5 +22,5 @@ $states['GR'] = array(
'J' => __( 'Πελοπόννησος', 'woocommerce' ),
'K' => __( 'Βόρειο Αιγαίο', 'woocommerce' ),
'L' => __( 'Νότιο Αιγαίο', 'woocommerce' ),
'M' => __( 'Κρήτη', 'woocommerce' )
'M' => __( 'Κρήτη', 'woocommerce' ),
);

View File

@ -12,5 +12,5 @@ global $states;
$states['HK'] = array(
'HONG KONG' => __( 'Hong Kong Island', 'woocommerce' ),
'KOWLOON' => __( 'Kowloon', 'woocommerce' ),
'NEW TERRITORIES' => __( 'New Territories', 'woocommerce' )
'NEW TERRITORIES' => __( 'New Territories', 'woocommerce' ),
);

View File

@ -29,5 +29,5 @@ $states['HU'] = array(
'TO' => __( 'Tolna', 'woocommerce' ),
'VA' => __( 'Vas', 'woocommerce' ),
'VE' => __( 'Veszprém', 'woocommerce' ),
'ZA' => __( 'Zala', 'woocommerce' )
'ZA' => __( 'Zala', 'woocommerce' ),
);

View File

@ -43,5 +43,5 @@ $states['ID'] = array(
'MA' => __( 'Maluku', 'woocommerce' ),
'MU' => __( 'Maluku Utara', 'woocommerce' ),
'PA' => __( 'Papua', 'woocommerce' ),
'PB' => __( 'Papua Barat', 'woocommerce' )
'PB' => __( 'Papua Barat', 'woocommerce' ),
);

View File

@ -45,5 +45,5 @@ $states['IN'] = array(
'DD' => __( 'Daman and Diu', 'woocommerce' ),
'DL' => __( 'Delhi', 'woocommerce' ),
'LD' => __( 'Lakshadeep', 'woocommerce' ),
'PY' => __( 'Pondicherry (Puducherry)', 'woocommerce' )
'PY' => __( 'Pondicherry (Puducherry)', 'woocommerce' ),
);

View File

@ -40,5 +40,5 @@ $states['IR'] = array(
'MZN' => __( 'Mazandaran (مازندران)', 'woocommerce' ),
'MKZ' => __( 'Markazi (مرکزی)', 'woocommerce' ),
'HRZ' => __( 'Hormozgan (هرمزگان)', 'woocommerce' ),
'SBN' => __( 'Sistan and Baluchestan (سیستان و بلوچستان)', 'woocommerce' )
'SBN' => __( 'Sistan and Baluchestan (سیستان و بلوچستان)', 'woocommerce' ),
);

View File

@ -119,5 +119,5 @@ $states['IT'] = array(
'VR' => __( 'Verona', 'woocommerce' ),
'VV' => __( 'Vibo Valentia', 'woocommerce' ),
'VI' => __( 'Vicenza', 'woocommerce' ),
'VT' => __( 'Viterbo', 'woocommerce' )
'VT' => __( 'Viterbo', 'woocommerce' ),
);

View File

@ -41,5 +41,5 @@ $states['MX'] = array(
'Tlaxcala' => __( 'Tlaxcala', 'woocommerce' ),
'Veracruz' => __( 'Veracruz', 'woocommerce' ),
'Yucatan' => __( 'Yucatán', 'woocommerce' ),
'Zacatecas' => __( 'Zacatecas', 'woocommerce' )
'Zacatecas' => __( 'Zacatecas', 'woocommerce' ),
);

View File

@ -25,5 +25,5 @@ $states['MY'] = array(
'SGR' => __( 'Selangor', 'woocommerce' ),
'TRG' => __( 'Terengganu', 'woocommerce' ),
'PJY' => __( 'Putrajaya', 'woocommerce' ),
'KUL' => __( 'Kuala Lumpur', 'woocommerce' )
'KUL' => __( 'Kuala Lumpur', 'woocommerce' ),
);

View File

@ -23,5 +23,5 @@ $states['NP'] = array(
'NAR' => __( 'Narayani', 'woocommerce' ),
'RAP' => __( 'Rapti', 'woocommerce' ),
'SAG' => __( 'Sagarmatha', 'woocommerce' ),
'SET' => __( 'Seti', 'woocommerce' )
'SET' => __( 'Seti', 'woocommerce' ),
);

View File

@ -35,5 +35,5 @@ $states['PE'] = array(
'SAM' => __( 'San Mart&iacute;n', 'woocommerce' ),
'TAC' => __( 'Tacna', 'woocommerce' ),
'TUM' => __( 'Tumbes', 'woocommerce' ),
'UCA' => __( 'Ucayali', 'woocommerce' )
'UCA' => __( 'Ucayali', 'woocommerce' ),
);

View File

@ -86,5 +86,5 @@ $states['TH'] = array(
'TH-61' => __( 'Uthai Thani (&#3629;&#3640;&#3607;&#3633;&#3618;&#3608;&#3634;&#3609;&#3637;)', 'woocommerce' ),
'TH-53' => __( 'Uttaradit (&#3629;&#3640;&#3605;&#3619;&#3604;&#3636;&#3605;&#3606;&#3660;)', 'woocommerce' ),
'TH-95' => __( 'Yala (&#3618;&#3632;&#3621;&#3634;)', 'woocommerce' ),
'TH-35' => __( 'Yasothon (&#3618;&#3650;&#3626;&#3608;&#3619;)', 'woocommerce' )
'TH-35' => __( 'Yasothon (&#3618;&#3650;&#3626;&#3608;&#3619;)', 'woocommerce' ),
);

View File

@ -18,5 +18,5 @@ $states['ZA'] = array(
'MP' => __( 'Mpumalanga', 'woocommerce' ),
'NC' => __( 'Northern Cape', 'woocommerce' ),
'NW' => __( 'North West', 'woocommerce' ),
'WC' => __( 'Western Cape', 'woocommerce' )
'WC' => __( 'Western Cape', 'woocommerce' ),
);

View File

@ -264,6 +264,16 @@ abstract class WC_Data {
}
}
/**
* Callback to remove unwanted meta data.
*
* @param object $meta
* @return bool
*/
protected function exclude_internal_meta_keys( $meta ) {
return ! in_array( $meta->meta_key, $this->get_internal_meta_keys() );
}
/**
* Read Meta Data from the database. Ignore any internal properties.
* @since 2.6.0
@ -296,10 +306,8 @@ abstract class WC_Data {
", $this->get_id() ) );
if ( $raw_meta_data ) {
$raw_meta_data = array_filter( $raw_meta_data, array( $this, 'exclude_internal_meta_keys' ) );
foreach ( $raw_meta_data as $meta ) {
if ( in_array( $meta->meta_key, $this->get_internal_meta_keys() ) ) {
continue;
}
$this->_meta_data[] = (object) array(
'id' => (int) $meta->{ $db_info['meta_id_field'] },
'key' => $meta->meta_key,
@ -390,6 +398,9 @@ abstract class WC_Data {
foreach ( $props as $prop => $value ) {
try {
if ( 'meta_data' === $prop ) {
continue;
}
$setter = "set_$prop";
if ( ! is_null( $value ) && is_callable( array( $this, $setter ) ) ) {
$this->{$setter}( $value );

View File

@ -51,9 +51,15 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @var array
*/
protected $_internal_meta_keys = array(
'_order_currency', '_cart_discount',
'_cart_discount_tax', '_order_shipping', '_order_shipping_tax',
'_order_tax', '_order_total', '_order_version', '_prices_include_tax',
'_order_currency',
'_cart_discount',
'_cart_discount_tax',
'_order_shipping',
'_order_shipping_tax',
'_order_tax',
'_order_total',
'_order_version',
'_prices_include_tax',
'_payment_tokens',
);
@ -243,7 +249,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
'post_parent' => $this->get_parent_id(),
),
array(
'ID' => $order_id
'ID' => $order_id,
)
);
@ -625,7 +631,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
return array(
'from' => $old_status,
'to' => $new_status
'to' => $new_status,
);
}
@ -1428,7 +1434,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$subtotal = wc_price( $this->get_line_subtotal( $item ), array( 'ex_tax_label' => $ex_tax_label, 'currency' => $this->get_currency() ) );
} else {
$subtotal = wc_price( $this->get_line_subtotal( $item, true ), array('currency' => $this->get_currency()) );
$subtotal = wc_price( $this->get_line_subtotal( $item, true ), array( 'currency' => $this->get_currency() ) );
}
return apply_filters( 'woocommerce_order_formatted_line_subtotal', $subtotal, $item, $this );
@ -1468,7 +1474,6 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
if ( 'excl' === $tax_display && $this->get_prices_include_tax() ) {
$subtotal .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
}
} else {
if ( 'incl' === $tax_display ) {
return '';
@ -1510,21 +1515,19 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
if ( $tax_display == 'excl' ) {
// Show shipping excluding tax.
$shipping = wc_price( $this->get_shipping_total(), array('currency' => $this->get_currency()) );
$shipping = wc_price( $this->get_shipping_total(), array( 'currency' => $this->get_currency() ) );
if ( $this->get_shipping_tax() != 0 && $this->get_prices_include_tax() ) {
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', '&nbsp;<small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>', $this, $tax_display );
}
} else {
// Show shipping including tax.
$shipping = wc_price( $this->get_shipping_total() + $this->get_shipping_tax(), array('currency' => $this->get_currency()) );
$shipping = wc_price( $this->get_shipping_total() + $this->get_shipping_tax(), array( 'currency' => $this->get_currency() ) );
if ( $this->get_shipping_tax() != 0 && ! $this->get_prices_include_tax() ) {
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_tax_label', '&nbsp;<small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>', $this, $tax_display );
}
}
$shipping .= apply_filters( 'woocommerce_order_shipping_to_display_shipped_via', '&nbsp;<small class="shipped_via">' . sprintf( __( 'via %s', 'woocommerce' ), $this->get_shipping_method() ) . '</small>', $this );
@ -1586,7 +1589,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
$total_rows[ 'fee_' . $fee->get_id() ] = array(
'label' => $fee->get_name() . ':',
'value' => wc_price( 'excl' === $tax_display ? $fee->get_total() : $fee->get_total() + $fee->get_total_tax(), array('currency' => $this->get_currency()) )
'value' => wc_price( 'excl' === $tax_display ? $fee->get_total() : $fee->get_total() + $fee->get_total_tax(), array( 'currency' => $this->get_currency() ) ),
);
}
}
@ -1603,7 +1606,6 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
'value' => $tax->formatted_amount,
);
}
} else {
$total_rows['tax'] = array(

View File

@ -294,5 +294,4 @@ if ( ! defined( 'ABSPATH' ) ) {
$wpdb->delete( $wpdb->prefix . 'woocommerce_payment_tokenmeta', array( 'payment_token_id' => $this->get_id() ), array( '%d' ) );
do_action( 'woocommerce_payment_token_deleted', $this->get_id(), $this );
}
}

View File

@ -400,7 +400,7 @@ class WC_Product {
if ( ! is_array( $file ) ) {
$downloadable_files[ $key ] = array(
'file' => $file,
'name' => ''
'name' => '',
);
}
@ -895,9 +895,7 @@ class WC_Product {
$price = $price * $qty;
}
}
} else {
$price = $price * $qty;
}
@ -970,12 +968,12 @@ class WC_Product {
$find = array(
'{price_including_tax}',
'{price_excluding_tax}'
'{price_excluding_tax}',
);
$replace = array(
wc_price( $this->get_price_including_tax( $qty, $price ) ),
wc_price( $this->get_price_excluding_tax( $qty, $price ) )
wc_price( $this->get_price_excluding_tax( $qty, $price ) ),
);
$price_display_suffix = str_replace( $find, $replace, $price_display_suffix );
@ -1010,7 +1008,6 @@ class WC_Product {
$price = apply_filters( 'woocommerce_price_html', $price, $this );
}
} elseif ( $this->get_price() === '' ) {
$price = apply_filters( 'woocommerce_empty_price_html', '', $this );
@ -1274,7 +1271,6 @@ class WC_Product {
} else {
$this->shipping_class = '';
}
}
return $this->shipping_class;
@ -1329,7 +1325,7 @@ class WC_Product {
$cats_array = $this->get_related_terms( 'product_cat' );
// Don't bother if none are set
if ( 1 === sizeof( $cats_array ) && 1 === sizeof( $tags_array )) {
if ( 1 === sizeof( $cats_array ) && 1 === sizeof( $tags_array ) ) {
$related_posts = array();
} else {
// Sanitize
@ -1376,7 +1372,6 @@ class WC_Product {
return $attribute['value'];
}
}
return '';
@ -1524,7 +1519,7 @@ class WC_Product {
*/
public function list_attributes() {
wc_get_template( 'single-product/product-attributes.php', array(
'product' => $this
'product' => $this,
) );
}
@ -1590,7 +1585,7 @@ class WC_Product {
* @return array
*/
protected function get_related_terms( $term ) {
$terms_array = array(0);
$terms_array = array( 0 );
$terms = apply_filters( 'woocommerce_get_related_' . $term . '_terms', wp_get_post_terms( $this->id, $term ), $this->id );
foreach ( $terms as $term ) {

View File

@ -105,4 +105,23 @@ abstract class WC_REST_Shipping_Zones_Controller_Base extends WC_REST_Controller
return true;
}
/**
* Check whether a given request has permission to delete Shipping Zones.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function delete_items_permissions_check( $request ) {
if ( ! wc_shipping_enabled() ) {
return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) );
}
if ( ! wc_rest_check_manager_permissions( 'settings', 'delete' ) ) {
return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
}

View File

@ -838,7 +838,7 @@ abstract class WC_Settings_API {
return wp_kses( trim( stripslashes( $value ) ),
array_merge(
array(
'iframe' => array( 'src' => true, 'style' => true, 'id' => true, 'class' => true )
'iframe' => array( 'src' => true, 'style' => true, 'id' => true, 'class' => true ),
),
wp_kses_allowed_html( 'post' )
)

View File

@ -52,7 +52,7 @@ abstract class WC_Widget extends WP_Widget {
$widget_ops = array(
'classname' => $this->widget_cssclass,
'description' => $this->widget_description,
'customize_selective_refresh' => true
'customize_selective_refresh' => true,
);
parent::__construct( $this->widget_id, $this->widget_name, $widget_ops );

View File

@ -25,7 +25,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
parent::__construct( array(
'singular' => __( 'key', 'woocommerce' ),
'plural' => __( 'keys', 'woocommerce' ),
'ajax' => false
'ajax' => false,
) );
}
@ -41,7 +41,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
'truncated_key' => __( 'Consumer Key Ending In', 'woocommerce' ),
'user' => __( 'User', 'woocommerce' ),
'permissions' => __( 'Permissions', 'woocommerce' ),
'last_access' => __( 'Last Access', 'woocommerce' )
'last_access' => __( 'Last Access', 'woocommerce' ),
);
}
@ -78,7 +78,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
$actions = array(
'id' => sprintf( __( 'ID: %d', 'woocommerce' ), $key['key_id'] ),
'edit' => '<a href="' . esc_url( $url ) . '">' . __( 'View/Edit', 'woocommerce' ) . '</a>',
'trash' => '<a class="submitdelete" title="' . esc_attr__( 'Revoke API Key', 'woocommerce' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key['key_id'] ), admin_url( 'admin.php?page=wc-settings&tab=api&section=keys' ) ), 'revoke' ) ) . '">' . __( 'Revoke', 'woocommerce' ) . '</a>'
'trash' => '<a class="submitdelete" title="' . esc_attr__( 'Revoke API Key', 'woocommerce' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key['key_id'] ), admin_url( 'admin.php?page=wc-settings&tab=api&section=keys' ) ), 'revoke' ) ) . '">' . __( 'Revoke', 'woocommerce' ) . '</a>',
);
$row_actions = array();
@ -133,7 +133,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
$permissions = array(
'read' => __( 'Read', 'woocommerce' ),
'write' => __( 'Write', 'woocommerce' ),
'read_write' => __( 'Read/Write', 'woocommerce' )
'read_write' => __( 'Read/Write', 'woocommerce' ),
);
if ( isset( $permissions[ $permission_key ] ) ) {
@ -166,7 +166,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
*/
protected function get_bulk_actions() {
return array(
'revoke' => __( 'Revoke', 'woocommerce' )
'revoke' => __( 'Revoke', 'woocommerce' ),
);
}
@ -211,7 +211,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
$this->set_pagination_args( array(
'total_items' => $count,
'per_page' => $per_page,
'total_pages' => ceil( $count / $per_page )
'total_pages' => ceil( $count / $per_page ),
) );
}
}

View File

@ -87,7 +87,7 @@ class WC_Admin_API_Keys {
'description' => '',
'permissions' => '',
'truncated_key' => '',
'last_access' => ''
'last_access' => '',
);
if ( 0 == $key_id ) {

View File

@ -123,12 +123,12 @@ class WC_Admin_Assets {
'i18n_searching' => _x( 'Searching&hellip;', 'enhanced select', 'woocommerce' ),
'ajax_url' => admin_url( 'admin-ajax.php' ),
'search_products_nonce' => wp_create_nonce( 'search-products' ),
'search_customers_nonce' => wp_create_nonce( 'search-customers' )
'search_customers_nonce' => wp_create_nonce( 'search-customers' ),
) );
// Accounting
wp_localize_script( 'accounting', 'accounting_params', array(
'mon_decimal_point' => wc_get_price_decimal_separator()
'mon_decimal_point' => wc_get_price_decimal_separator(),
) );
// WooCommerce admin pages
@ -148,7 +148,7 @@ class WC_Admin_Assets {
'i18n_country_iso_error' => __( 'Please enter in country code with two capital letters.', 'woocommerce' ),
'i18_sale_less_than_regular_error' => __( 'Please enter in a value less than the regular price.', 'woocommerce' ),
'decimal_point' => $decimal,
'mon_decimal_point' => wc_get_price_decimal_separator()
'mon_decimal_point' => wc_get_price_decimal_separator(),
);
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );
@ -202,7 +202,7 @@ class WC_Admin_Assets {
'i18n_edited_variations' => esc_js( __( 'Save changes before changing page?', 'woocommerce' ) ),
'i18n_variation_count_single' => esc_js( __( '%qty% variation', 'woocommerce' ) ),
'i18n_variation_count_plural' => esc_js( __( '%qty% variations', 'woocommerce' ) ),
'variations_per_page' => absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) )
'variations_per_page' => absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) ),
);
wp_localize_script( 'wc-admin-variation-meta-boxes', 'woocommerce_admin_meta_boxes_variations', $params );
@ -213,7 +213,7 @@ class WC_Admin_Assets {
$params = array(
'countries' => json_encode( array_merge( WC()->countries->get_allowed_country_states(), WC()->countries->get_shipping_country_states() ) ),
'i18n_select_state_text' => esc_attr__( 'Select an option&hellip;', 'woocommerce' )
'i18n_select_state_text' => esc_attr__( 'Select an option&hellip;', 'woocommerce' ),
);
wp_localize_script( 'wc-admin-order-meta-boxes', 'woocommerce_admin_meta_boxes_order', $params );
@ -284,7 +284,7 @@ class WC_Admin_Assets {
'i18n_permission_revoke' => __( 'Are you sure you want to revoke access to this download?', 'woocommerce' ),
'i18n_tax_rate_already_exists' => __( 'You cannot add the same tax rate twice!', 'woocommerce' ),
'i18n_product_type_alert' => __( 'Your product has variations! Before changing the product type, it is a good idea to delete the variations to avoid errors in the stock reports.', 'woocommerce' ),
'i18n_delete_note' => __( 'Are you sure you wish to delete this note? This action cannot be undone.', 'woocommerce' )
'i18n_delete_note' => __( 'Are you sure you wish to delete this note? This action cannot be undone.', 'woocommerce' ),
);
wp_localize_script( 'wc-admin-meta-boxes', 'woocommerce_admin_meta_boxes', $params );
@ -299,7 +299,7 @@ class WC_Admin_Assets {
$taxonomy = isset( $_GET['taxonomy'] ) ? wc_clean( $_GET['taxonomy'] ) : '';
$woocommerce_term_order_params = array(
'taxonomy' => $taxonomy
'taxonomy' => $taxonomy,
);
wp_localize_script( 'woocommerce_term_ordering', 'woocommerce_term_ordering_params', $woocommerce_term_order_params );
@ -367,9 +367,9 @@ class WC_Admin_Assets {
if ( ! current_user_can( 'manage_woocommerce' ) ) return;
?>
<style type="text/css">
<?php if ( isset($_GET['taxonomy']) && $_GET['taxonomy']=='product_cat' ) : ?>
<?php if ( isset( $_GET['taxonomy'] ) && 'product_cat' === $_GET['taxonomy'] ) : ?>
.icon32-posts-product { background-position: -243px -5px !important; }
<?php elseif ( isset($_GET['taxonomy']) && $_GET['taxonomy']=='product_tag' ) : ?>
<?php elseif ( isset( $_GET['taxonomy'] ) && 'product_tag' === $_GET['taxonomy'] ) : ?>
.icon32-posts-product { background-position: -301px -5px !important; }
<?php endif; ?>
</style>

View File

@ -72,7 +72,7 @@ class WC_Admin_Attributes {
'attribute_name' => isset( $_POST['attribute_name'] ) ? wc_sanitize_taxonomy_name( stripslashes( $_POST['attribute_name'] ) ) : '',
'attribute_type' => isset( $_POST['attribute_type'] ) ? wc_clean( $_POST['attribute_type'] ) : 'select',
'attribute_orderby' => isset( $_POST['attribute_orderby'] ) ? wc_clean( $_POST['attribute_orderby'] ) : '',
'attribute_public' => isset( $_POST['attribute_public'] ) ? 1 : 0
'attribute_public' => isset( $_POST['attribute_public'] ) ? 1 : 0,
);
if ( empty( $attribute['attribute_type'] ) ) {

View File

@ -200,7 +200,6 @@ class WC_Admin_Dashboard {
echo '<p>' . __( 'There are no product reviews yet.', 'woocommerce' ) . '</p>';
}
}
}
endif;

View File

@ -156,7 +156,7 @@ class WC_Admin_Duplicate_Product {
'post_modified_gmt' => $new_post_date_gmt,
'post_parent' => $post_parent,
'menu_order' => $post->menu_order,
'post_mime_type' => $post->post_mime_type
'post_mime_type' => $post->post_mime_type,
)
);
@ -171,7 +171,7 @@ class WC_Admin_Duplicate_Product {
'post_title' => $post_title,
),
array(
'ID' => $new_post_id
'ID' => $new_post_id,
)
);
}
@ -185,7 +185,7 @@ class WC_Admin_Duplicate_Product {
'guid' => get_permalink( $new_post_id ),
),
array(
'ID' => $new_post_id
'ID' => $new_post_id,
)
);
}

View File

@ -39,116 +39,116 @@ class WC_Admin_Help {
$video_map = array(
'wc-settings' => array(
'title' => __( 'General Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true',
),
'wc-settings-general' => array(
'title' => __( 'General Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true',
),
'wc-settings-products' => array(
'title' => __( 'Product Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf?videoFoam=true',
),
'wc-settings-tax' => array(
'title' => __( 'Tax Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh?videoFoam=true',
),
'wc-settings-shipping' => array(
'title' => __( 'Shipping Zones', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/95yiocro6p?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/95yiocro6p?videoFoam=true',
),
'wc-settings-shipping-options' => array(
'title' => __( 'Shipping Options', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr?videoFoam=true',
),
'wc-settings-shipping-classes' => array(
'title' => __( 'Shipping Classes', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/tpqg17aq99?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/tpqg17aq99?videoFoam=true',
),
'wc-settings-checkout' => array(
'title' => __( 'Checkout Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/65yjv96z51?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/65yjv96z51?videoFoam=true',
),
'wc-settings-checkout-bacs' => array(
'title' => __( 'Bank Transfer (BACS) Payments', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/dh4piy3sek?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/dh4piy3sek?videoFoam=true',
),
'wc-settings-checkout-cheque' => array(
'title' => __( 'Check Payments', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/u2m2kcakea?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/u2m2kcakea?videoFoam=true',
),
'wc-settings-checkout-cod' => array(
'title' => __( 'Cash on Delivery', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/8hyli8wu5f?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/8hyli8wu5f?videoFoam=true',
),
'wc-settings-checkout-paypal' => array(
'title' => __( 'PayPal Standard', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/rbl7e7l4k2?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/rbl7e7l4k2?videoFoam=true',
),
'wc-settings-checkout-paypalbraintree_cards' => array(
'title' => __( 'PayPal by Braintree', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/oyksirgn40?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/oyksirgn40?videoFoam=true',
),
'wc-settings-checkout-stripe' => array(
'title' => __( 'Stripe', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/mf975hx5de?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/mf975hx5de?videoFoam=true',
),
'wc-settings-checkout-simplify_commerce' => array(
'title' => __( 'Simplify Commerce', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/jdfzjiiw61?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/jdfzjiiw61?videoFoam=true',
),
'wc-settings-account' => array(
'title' => __( 'Account Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/35mazq7il2?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/35mazq7il2?videoFoam=true',
),
'wc-settings-email' => array(
'title' => __( 'Email Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv?videoFoam=true',
),
'wc-settings-api' => array(
'title' => __( 'Webhook Settings', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq?videoFoam=true',
),
'product' => array(
'title' => __( 'Simple Products', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/ziyjmd4kut?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/ziyjmd4kut?videoFoam=true',
),
'edit-product_cat' => array(
'title' => __( 'Product Categories', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true',
),
'edit-product_tag' => array(
'title' => __( 'Product Categories, Tags, Shipping Classes, &amp; Attributes', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true',
),
'product_attributes' => array(
'title' => __( 'Product Categories, Tags, Shipping Classes, &amp; Attributes', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true',
),
'wc-status' => array(
'title' => __( 'System Status', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi?videoFoam=true',
),
'wc-reports' => array(
'title' => __( 'Reports', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/6aasex0w99?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/6aasex0w99?videoFoam=true',
),
'edit-shop_coupon' => array(
'title' => __( 'Coupons', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true',
),
'shop_coupon' => array(
'title' => __( 'Coupons', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true',
),
'edit-shop_order' => array(
'title' => __( 'Managing Orders', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'
'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true',
),
'shop_order' => array(
'title' => __( 'Managing Orders', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'
)
'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true',
),
);
$page = empty( $_GET['page'] ) ? '' : sanitize_title( $_GET['page'] );
@ -172,7 +172,7 @@ class WC_Admin_Help {
'title' => __( 'WooCommerce 101', 'woocommerce' ),
'content' =>
'<h2><a href="https://docs.woocommerce.com/document/woocommerce-101-video-series/?utm_source=helptab&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin">' . __( 'WooCommerce 101', 'woocommerce' ) . '</a> &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' .
'<iframe data-src="' . esc_url( $video_map[ $video_key ]['url'] ) . '" src="" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="480" height="298"></iframe>'
'<iframe data-src="' . esc_url( $video_map[ $video_key ]['url'] ) . '" src="" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="480" height="298"></iframe>',
) );
}
@ -194,7 +194,7 @@ class WC_Admin_Help {
'</a>'
) . '</p>' .
'<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' .
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System Status', 'woocommerce' ) . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __( 'Community Forum', 'woocommerce' ) . '</a> <a href="' . 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' . '" class="button">' . __( 'WooCommerce Helpdesk', 'woocommerce' ) . '</a></p>'
'<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System Status', 'woocommerce' ) . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __( 'Community Forum', 'woocommerce' ) . '</a> <a href="' . 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' . '" class="button">' . __( 'WooCommerce Helpdesk', 'woocommerce' ) . '</a></p>',
) );
$screen->add_help_tab( array(
@ -203,7 +203,7 @@ class WC_Admin_Help {
'content' =>
'<h2>' . __( 'Found a bug?', 'woocommerce' ) . '</h2>' .
'<p>' . sprintf( __( 'If you find a bug within WooCommerce core you can create a ticket via <a href="%s">Github issues</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%s">system status report</a>.', 'woocommerce' ), 'https://github.com/woothemes/woocommerce/issues?state=open', 'https://github.com/woothemes/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url( 'admin.php?page=wc-status' ) ) . '</p>' .
'<p><a href="' . 'https://github.com/woothemes/woocommerce/issues?state=open' . '" class="button button-primary">' . __( 'Report a bug', 'woocommerce' ) . '</a> <a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button">' . __( 'System Status', 'woocommerce' ) . '</a></p>'
'<p><a href="' . 'https://github.com/woothemes/woocommerce/issues?state=open' . '" class="button button-primary">' . __( 'Report a bug', 'woocommerce' ) . '</a> <a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button">' . __( 'System Status', 'woocommerce' ) . '</a></p>',
) );
@ -213,7 +213,7 @@ class WC_Admin_Help {
'content' =>
'<h2>' . __( 'Education', 'woocommerce' ) . '</h2>' .
'<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course offered by one of our educational partners.', 'woocommerce' ) . '</p>' .
'<p><a href="' . 'https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin' . '" class="button button-primary">' . __( 'View Education Partners', 'woocommerce' ) . '</a></p>'
'<p><a href="' . 'https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin' . '" class="button button-primary">' . __( 'View Education Partners', 'woocommerce' ) . '</a></p>',
) );
$screen->add_help_tab( array(
@ -222,7 +222,7 @@ class WC_Admin_Help {
'content' =>
'<h2>' . __( 'Setup Wizard', 'woocommerce' ) . '</h2>' .
'<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' .
'<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup Wizard', 'woocommerce' ) . '</a></p>'
'<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup Wizard', 'woocommerce' ) . '</a></p>',
) );
@ -235,7 +235,6 @@ class WC_Admin_Help {
'<p><a href="' . 'https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'Official Extensions', 'woocommerce' ) . '</a></p>'
);
}
}
endif;

View File

@ -94,7 +94,7 @@ class WC_Admin_Importers {
'attribute_name' => $attribute_name,
'attribute_type' => 'select',
'attribute_orderby' => 'menu_order',
'attribute_public' => 0
'attribute_public' => 0,
);
$wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute );
delete_transient( 'wc_attribute_taxonomies' );

View File

@ -178,7 +178,6 @@ class WC_Admin_Menus {
} elseif ( ! in_array( $item, array( 'separator-woocommerce' ) ) ) {
$woocommerce_menu_order[] = $item;
}
}
// Return order
@ -325,7 +324,7 @@ class WC_Admin_Menus {
'parent' => 'site-name',
'id' => 'view-store',
'title' => __( 'Visit Store', 'woocommerce' ),
'href' => wc_get_page_permalink( 'shop' )
'href' => wc_get_page_permalink( 'shop' ),
) );
}
}

View File

@ -210,7 +210,6 @@ class WC_Admin_Meta_Boxes {
do_action( 'woocommerce_process_' . $post->post_type . '_meta', $post_id, $post );
}
}
}
new WC_Admin_Meta_Boxes();

View File

@ -235,7 +235,7 @@ class WC_Admin_Notices {
$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
$theme_file = get_template_directory() . '/' . $file;
} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
} elseif ( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
$theme_file = get_template_directory() . '/woocommerce/' . $file;
}

View File

@ -106,7 +106,7 @@ class WC_Admin_Permalink_Settings {
$structures = array(
0 => '',
1 => '/' . trailingslashit( $base_slug ),
2 => '/' . trailingslashit( $base_slug ) . trailingslashit( '%product_cat%' )
2 => '/' . trailingslashit( $base_slug ) . trailingslashit( '%product_cat%' ),
);
?>
<table class="form-table wc-permalink-structure">

View File

@ -54,162 +54,162 @@ class WC_Admin_Pointers {
'next' => 'content',
'next_trigger' => array(
'target' => '#title',
'event' => 'input'
'event' => 'input',
),
'options' => array(
'content' => '<h3>' . esc_html__( 'Product Name', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Product Name', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'Give your new product a name here. This is a required field and will be what your customers will see in your store.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'top',
'align' => 'left'
)
)
'align' => 'left',
),
),
),
'content' => array(
'target' => "#wp-content-editor-container",
'next' => 'product-type',
'next_trigger' => array(),
'options' => array(
'content' => '<h3>' . esc_html__( 'Product Description', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Product Description', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'This is your products main body of content. Here you should describe your product in detail.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'bottom',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'product-type' => array(
'target' => "#product-type",
'next' => 'virtual',
'next_trigger' => array(
'target' => "#product-type",
'event' => 'change blur click'
'event' => 'change blur click',
),
'options' => array(
'content' => '<h3>' . esc_html__( 'Choose Product Type', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Choose Product Type', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'Choose a type for this product. Simple is suitable for most physical goods and services (we recommend setting up a simple product for now).', 'woocommerce' ) . '</p>' .
'<p>' . esc_html__( 'Variable is for more complex products such as t-shirts with multiple sizes.', 'woocommerce' ) . '</p>' .
'<p>' . esc_html__( 'Grouped products are for grouping several simple products into one.', 'woocommerce' ) . '</p>' .
'<p>' . esc_html__( 'Finally, external products are for linking off-site.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'bottom',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'virtual' => array(
'target' => "#_virtual",
'next' => 'downloadable',
'next_trigger' => array(
'target' => "#_virtual",
'event' => 'change'
'event' => 'change',
),
'options' => array(
'content' => '<h3>' . esc_html__( 'Virtual Products', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Virtual Products', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'Check the "Virtual" box if this is a non-physical item, for example a service, which does not need shipping.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'bottom',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'downloadable' => array(
'target' => "#_downloadable",
'next' => 'regular_price',
'next_trigger' => array(
'target' => "#_downloadable",
'event' => 'change'
'event' => 'change',
),
'options' => array(
'content' => '<h3>' . esc_html__( 'Downloadable Products', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Downloadable Products', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'If purchasing this product gives a customer access to a downloadable file, e.g. software, check this box.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'bottom',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'regular_price' => array(
'target' => "#_regular_price",
'next' => 'postexcerpt',
'next_trigger' => array(
'target' => "#_regular_price",
'event' => 'input'
'event' => 'input',
),
'options' => array(
'content' => '<h3>' . esc_html__( 'Prices', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Prices', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'Next you\'ll need to give your product a price.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'bottom',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'postexcerpt' => array(
'target' => "#postexcerpt",
'next' => 'postimagediv',
'next_trigger' => array(
'target' => "#postexcerpt",
'event' => 'input'
'event' => 'input',
),
'options' => array(
'content' => '<h3>' . esc_html__( 'Product Short Description', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Product Short Description', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'Add a quick summary for your product here. This will appear on the product page under the product name.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'bottom',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'postimagediv' => array(
'target' => "#postimagediv",
'next' => 'product_tag',
'options' => array(
'content' => '<h3>' . esc_html__( 'Product Images', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Product Images', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'Upload or assign an image to your product here. This image will be shown in your store\'s catalog.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'right',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'product_tag' => array(
'target' => "#tagsdiv-product_tag",
'next' => 'product_catdiv',
'options' => array(
'content' => '<h3>' . esc_html__( 'Product Tags', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Product Tags', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'You can optionally "tag" your products here. Tags as a method of labeling your products to make them easier for customers to find.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'right',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'product_catdiv' => array(
'target' => "#product_catdiv",
'next' => 'submitdiv',
'options' => array(
'content' => '<h3>' . esc_html__( 'Product Categories', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Product Categories', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'Optionally assign categories to your products to make them easier to browse through and find in your store.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'right',
'align' => 'middle'
)
)
'align' => 'middle',
),
),
),
'submitdiv' => array(
'target' => "#submitdiv",
'next' => '',
'options' => array(
'content' => '<h3>' . esc_html__( 'Publish Your Product!', 'woocommerce' ) . '</h3>' .
'content' => '<h3>' . esc_html__( 'Publish Your Product!', 'woocommerce' ) . '</h3>' .
'<p>' . esc_html__( 'When you are finished editing your product, hit the "Publish" button to publish your product to your store.', 'woocommerce' ) . '</p>',
'position' => array(
'edge' => 'right',
'align' => 'middle'
)
)
)
)
'align' => 'middle',
),
),
),
),
);
$this->enqueue_pointers( $pointers );

View File

@ -150,7 +150,7 @@ class WC_Admin_Post_Types {
9 => sprintf( __( 'Order scheduled for: <strong>%1$s</strong>.', 'woocommerce' ),
date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $post->post_date ) ) ),
10 => __( 'Order draft updated.', 'woocommerce' ),
11 => __( 'Order updated and email sent.', 'woocommerce' )
11 => __( 'Order updated and email sent.', 'woocommerce' ),
);
$messages['shop_coupon'] = array(
@ -165,7 +165,7 @@ class WC_Admin_Post_Types {
8 => __( 'Coupon submitted.', 'woocommerce' ),
9 => sprintf( __( 'Coupon scheduled for: <strong>%1$s</strong>.', 'woocommerce' ),
date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $post->post_date ) ) ),
10 => __( 'Coupon draft updated.', 'woocommerce' )
10 => __( 'Coupon draft updated.', 'woocommerce' ),
);
return $messages;
@ -365,7 +365,6 @@ class WC_Admin_Post_Types {
} else {
echo '<span class="product-type tips simple" data-tip="' . esc_attr__( 'Simple', 'woocommerce' ) . '"></span>';
}
} elseif ( 'variable' == $the_product->product_type ) {
echo '<span class="product-type tips variable" data-tip="' . esc_attr__( 'Variable', 'woocommerce' ) . '"></span>';
} else {
@ -706,7 +705,7 @@ class WC_Admin_Post_Types {
$latest_notes = get_comments( array(
'post_id' => $post->ID,
'number' => 1,
'status' => $status
'status' => $status,
) );
$latest_note = current( $latest_notes );
@ -718,7 +717,6 @@ class WC_Admin_Post_Types {
} else {
echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip( sprintf( _n( '%d note', '%d notes', $post->comment_count, 'woocommerce' ), $post->comment_count ) ) . '">' . __( 'Yes', 'woocommerce' ) . '</span>';
}
} else {
echo '<span class="na">&ndash;</span>';
}
@ -780,7 +778,7 @@ class WC_Admin_Post_Types {
$actions['processing'] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=processing&order_id=' . $post->ID ), 'woocommerce-mark-order-status' ),
'name' => __( 'Processing', 'woocommerce' ),
'action' => "processing"
'action' => "processing",
);
}
@ -788,14 +786,14 @@ class WC_Admin_Post_Types {
$actions['complete'] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=completed&order_id=' . $post->ID ), 'woocommerce-mark-order-status' ),
'name' => __( 'Complete', 'woocommerce' ),
'action' => "complete"
'action' => "complete",
);
}
$actions['view'] = array(
'url' => admin_url( 'post.php?post=' . $post->ID . '&action=edit' ),
'name' => __( 'View', 'woocommerce' ),
'action' => "view"
'action' => "view",
);
$actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $the_order );
@ -823,7 +821,7 @@ class WC_Admin_Post_Types {
'price' => 'price',
'featured' => array( 'featured', 1 ),
'sku' => 'sku',
'name' => 'title'
'name' => 'title',
);
return wp_parse_args( $custom, $columns );
}
@ -848,7 +846,7 @@ class WC_Admin_Post_Types {
$custom = array(
'order_title' => 'ID',
'order_total' => 'order_total',
'order_date' => 'date'
'order_date' => 'date',
);
unset( $columns['comments'] );
@ -1400,7 +1398,6 @@ class WC_Admin_Post_Types {
if ( ! empty( $_REQUEST['_backorders'] ) ) {
update_post_meta( $post_id, '_backorders', wc_clean( $_REQUEST['_backorders'] ) );
}
}
do_action( 'woocommerce_product_bulk_edit_save', $product );
@ -1575,7 +1572,7 @@ class WC_Admin_Post_Types {
$this->shop_order_filters();
} elseif ( 'product' == $typenow ) {
$this->product_filters();
} elseif( 'shop_coupon' == $typenow ) {
} elseif ( 'shop_coupon' == $typenow ) {
$this->shop_coupon_filters();
}
}
@ -1703,30 +1700,28 @@ class WC_Admin_Post_Types {
if ( 'price' == $vars['orderby'] ) {
$vars = array_merge( $vars, array(
'meta_key' => '_price',
'orderby' => 'meta_value_num'
'orderby' => 'meta_value_num',
) );
}
if ( 'featured' == $vars['orderby'] ) {
$vars = array_merge( $vars, array(
'meta_key' => '_featured',
'orderby' => 'meta_value'
'orderby' => 'meta_value',
) );
}
if ( 'sku' == $vars['orderby'] ) {
$vars = array_merge( $vars, array(
'meta_key' => '_sku',
'orderby' => 'meta_value'
'orderby' => 'meta_value',
) );
}
}
} elseif ( 'shop_coupon' === $typenow ) {
if ( ! empty( $_GET['coupon_type'] ) ) {
$vars['meta_key'] = 'discount_type';
$vars['meta_value'] = wc_clean( $_GET['coupon_type'] );
}
} elseif ( in_array( $typenow, wc_get_order_types( 'order-meta-boxes' ) ) ) {
// Filter the orders by the posted customer.
@ -1735,8 +1730,8 @@ class WC_Admin_Post_Types {
array(
'key' => '_customer_user',
'value' => (int) $_GET['_customer_user'],
'compare' => '='
)
'compare' => '=',
),
);
}
@ -1745,7 +1740,7 @@ class WC_Admin_Post_Types {
if ( 'order_total' == $vars['orderby'] ) {
$vars = array_merge( $vars, array(
'meta_key' => '_order_total',
'orderby' => 'meta_value_num'
'orderby' => 'meta_value_num',
) );
}
}
@ -1798,7 +1793,7 @@ class WC_Admin_Post_Types {
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => get_terms( 'product_cat', array( 'fields' => 'ids' ) ),
'operator' => 'NOT IN'
'operator' => 'NOT IN',
);
}
@ -1808,7 +1803,7 @@ class WC_Admin_Post_Types {
'taxonomy' => 'product_shipping_class',
'field' => 'id',
'terms' => get_terms( 'product_shipping_class', array( 'fields' => 'ids' ) ),
'operator' => 'NOT IN'
'operator' => 'NOT IN',
);
}
}
@ -1954,7 +1949,6 @@ class WC_Admin_Post_Types {
delete_transient( 'woocommerce_processing_order_count' );
wc_delete_shop_order_transients( $id );
}
}
}
@ -2101,7 +2095,7 @@ class WC_Admin_Post_Types {
'visible' => __( 'Catalog/search', 'woocommerce' ),
'catalog' => __( 'Catalog', 'woocommerce' ),
'search' => __( 'Search', 'woocommerce' ),
'hidden' => __( 'Hidden', 'woocommerce' )
'hidden' => __( 'Hidden', 'woocommerce' ),
) );
?>
<div class="misc-pub-section" id="catalog-visibility">

View File

@ -42,99 +42,99 @@ class WC_Admin_Profile {
'fields' => array(
'billing_first_name' => array(
'label' => __( 'First name', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_last_name' => array(
'label' => __( 'Last name', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_company' => array(
'label' => __( 'Company', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_city' => array(
'label' => __( 'City', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_country' => array(
'label' => __( 'Country', 'woocommerce' ),
'description' => '',
'class' => 'js_field-country',
'type' => 'select',
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries()
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'billing_state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'description' => __( 'State/County or state code', 'woocommerce' ),
'class' => 'js_field-state'
'class' => 'js_field-state',
),
'billing_phone' => array(
'label' => __( 'Telephone', 'woocommerce' ),
'description' => ''
'description' => '',
),
'billing_email' => array(
'label' => __( 'Email', 'woocommerce' ),
'description' => ''
)
)
'description' => '',
),
),
),
'shipping' => array(
'title' => __( 'Customer Shipping Address', 'woocommerce' ),
'fields' => array(
'shipping_first_name' => array(
'label' => __( 'First name', 'woocommerce' ),
'description' => ''
'description' => '',
),
'shipping_last_name' => array(
'label' => __( 'Last name', 'woocommerce' ),
'description' => ''
'description' => '',
),
'shipping_company' => array(
'label' => __( 'Company', 'woocommerce' ),
'description' => ''
'description' => '',
),
'shipping_address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'description' => ''
'description' => '',
),
'shipping_address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'description' => ''
'description' => '',
),
'shipping_city' => array(
'label' => __( 'City', 'woocommerce' ),
'description' => ''
'description' => '',
),
'shipping_postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'description' => ''
'description' => '',
),
'shipping_country' => array(
'label' => __( 'Country', 'woocommerce' ),
'description' => '',
'class' => 'js_field-country',
'type' => 'select',
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries()
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'shipping_state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'description' => __( 'State/County or state code', 'woocommerce' ),
'class' => 'js_field-state'
)
)
)
'class' => 'js_field-state',
),
),
),
) );
return $show_fields;
}

View File

@ -48,27 +48,27 @@ class WC_Admin_Reports {
'title' => __( 'Sales by date', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
"sales_by_product" => array(
'title' => __( 'Sales by product', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
"sales_by_category" => array(
'title' => __( 'Sales by category', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
"coupon_usage" => array(
'title' => __( 'Coupons by date', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
)
)
'callback' => array( __CLASS__, 'get_report' ),
),
),
),
'customers' => array(
'title' => __( 'Customers', 'woocommerce' ),
@ -77,15 +77,15 @@ class WC_Admin_Reports {
'title' => __( 'Customers vs. Guests', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
"customer_list" => array(
'title' => __( 'Customer List', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
)
),
),
'stock' => array(
'title' => __( 'Stock', 'woocommerce' ),
@ -94,22 +94,22 @@ class WC_Admin_Reports {
'title' => __( 'Low in stock', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
"out_of_stock" => array(
'title' => __( 'Out of stock', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
"most_stocked" => array(
'title' => __( 'Most Stocked', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
)
)
),
),
);
if ( wc_tax_enabled() ) {
@ -120,15 +120,15 @@ class WC_Admin_Reports {
'title' => __( 'Taxes by code', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
"taxes_by_date" => array(
'title' => __( 'Taxes by date', 'woocommerce' ),
'description' => '',
'hide_title' => true,
'callback' => array( __CLASS__, 'get_report' )
'callback' => array( __CLASS__, 'get_report' ),
),
)
),
);
}

View File

@ -139,7 +139,7 @@ class WC_Admin_Settings {
wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'select2' ), WC()->version, true );
wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' )
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ),
) );
// Include settings pages
@ -501,11 +501,11 @@ class WC_Admin_Settings {
// Image width settings
case 'image_width' :
$image_size = str_replace( '_image_size', '', $value[ 'id' ] );
$image_size = str_replace( '_image_size', '', $value['id'] );
$size = wc_get_image_size( $image_size );
$width = isset( $size[ 'width' ] ) ? $size[ 'width' ] : $value[ 'default' ][ 'width' ];
$height = isset( $size[ 'height' ] ) ? $size[ 'height' ] : $value[ 'default' ][ 'height' ];
$crop = isset( $size[ 'crop' ] ) ? $size[ 'crop' ] : $value[ 'default' ][ 'crop' ];
$width = isset( $size['width'] ) ? $size['width'] : $value['default']['width'];
$height = isset( $size['height'] ) ? $size['height'] : $value['default']['height'];
$crop = isset( $size['crop'] ) ? $size['crop'] : $value['default']['crop'];
$disabled_attr = '';
$disabled_message = '';
@ -537,7 +537,7 @@ class WC_Admin_Settings {
'show_option_none' => ' ',
'class' => $value['class'],
'echo' => false,
'selected' => absint( self::get_option( $value['id'] ) )
'selected' => absint( self::get_option( $value['id'] ) ),
);
if ( isset( $value['args'] ) ) {
@ -652,7 +652,7 @@ class WC_Admin_Settings {
return array(
'description' => $description,
'tooltip_html' => $tooltip_html
'tooltip_html' => $tooltip_html,
);
}
@ -802,7 +802,6 @@ class WC_Admin_Settings {
if ( file_exists( $downloads_url . '/.htaccess' ) ) {
unlink( $downloads_url . '/.htaccess' );
}
} else {
// Force method - protect, add rules to the htaccess file

View File

@ -27,7 +27,7 @@ class WC_Admin_Setup_Wizard {
/** @var array Tweets user can optionally send after install */
private $tweets = array(
'Someone give me woo-t, I just set up a new store with #WordPress and @WooCommerce!',
'Someone give me high five, I just set up a new store with #WordPress and @WooCommerce!'
'Someone give me high five, I just set up a new store with #WordPress and @WooCommerce!',
);
/**
@ -56,35 +56,35 @@ class WC_Admin_Setup_Wizard {
}
$this->steps = array(
'introduction' => array(
'name' => __( 'Introduction', 'woocommerce' ),
'name' => __( 'Introduction', 'woocommerce' ),
'view' => array( $this, 'wc_setup_introduction' ),
'handler' => ''
'handler' => '',
),
'pages' => array(
'name' => __( 'Page Setup', 'woocommerce' ),
'name' => __( 'Page Setup', 'woocommerce' ),
'view' => array( $this, 'wc_setup_pages' ),
'handler' => array( $this, 'wc_setup_pages_save' )
'handler' => array( $this, 'wc_setup_pages_save' ),
),
'locale' => array(
'name' => __( 'Store Locale', 'woocommerce' ),
'name' => __( 'Store Locale', 'woocommerce' ),
'view' => array( $this, 'wc_setup_locale' ),
'handler' => array( $this, 'wc_setup_locale_save' )
'handler' => array( $this, 'wc_setup_locale_save' ),
),
'shipping_taxes' => array(
'name' => __( 'Shipping &amp; Tax', 'woocommerce' ),
'name' => __( 'Shipping &amp; Tax', 'woocommerce' ),
'view' => array( $this, 'wc_setup_shipping_taxes' ),
'handler' => array( $this, 'wc_setup_shipping_taxes_save' ),
),
'payments' => array(
'name' => __( 'Payments', 'woocommerce' ),
'name' => __( 'Payments', 'woocommerce' ),
'view' => array( $this, 'wc_setup_payments' ),
'handler' => array( $this, 'wc_setup_payments_save' ),
),
'next_steps' => array(
'name' => __( 'Ready!', 'woocommerce' ),
'name' => __( 'Ready!', 'woocommerce' ),
'view' => array( $this, 'wc_setup_ready' ),
'handler' => ''
)
'handler' => '',
),
);
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@ -107,14 +107,14 @@ class WC_Admin_Setup_Wizard {
'i18n_searching' => _x( 'Searching&hellip;', 'enhanced select', 'woocommerce' ),
'ajax_url' => admin_url( 'admin-ajax.php' ),
'search_products_nonce' => wp_create_nonce( 'search-products' ),
'search_customers_nonce' => wp_create_nonce( 'search-customers' )
'search_customers_nonce' => wp_create_nonce( 'search-customers' ),
) );
wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
wp_enqueue_style( 'wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array( 'dashicons', 'install' ), WC_VERSION );
wp_register_script( 'wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup.min.js', array( 'jquery', 'wc-enhanced-select', 'jquery-blockui' ), WC_VERSION );
wp_localize_script( 'wc-setup', 'wc_setup_params', array(
'locale_info' => json_encode( include( WC()->plugin_path() . '/i18n/locale-info.php' ) )
'locale_info' => json_encode( include( WC()->plugin_path() . '/i18n/locale-info.php' ) ),
) );
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
@ -546,7 +546,7 @@ class WC_Admin_Setup_Wizard {
'tax_rate_compound' => 0,
'tax_rate_shipping' => $rate['shipping'] ? 1 : 0,
'tax_rate_order' => $loop ++,
'tax_rate_class' => ''
'tax_rate_class' => '',
);
WC_Tax::_insert_tax_rate( $tax_rate );
}
@ -615,7 +615,7 @@ class WC_Admin_Setup_Wizard {
'description' => __( 'A simple offline gateway that lets you accept cash on delivery.', 'woocommerce' ),
'image' => '',
'class' => '',
)
),
);
$country = WC()->countries->get_base_country();

View File

@ -88,7 +88,7 @@ class WC_Admin_Status {
$handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
if ( ! empty( $_REQUEST[ 'handle' ] ) ) {
if ( ! empty( $_REQUEST['handle'] ) ) {
self::remove_log();
}
@ -151,7 +151,7 @@ class WC_Admin_Status {
foreach ( $files as $key => $value ) {
if ( ! in_array( $value, array( ".",".." ) ) ) {
if ( ! in_array( $value, array( ".", ".." ) ) ) {
if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
$sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
@ -185,7 +185,6 @@ class WC_Admin_Status {
}
}
}
}
return $result;
@ -202,7 +201,7 @@ class WC_Admin_Status {
'fields' => array(
'sections' => false,
'tags' => false,
)
),
) );
$update_theme_version = 0;
@ -244,13 +243,13 @@ class WC_Admin_Status {
* Remove/delete the chosen file.
*/
public static function remove_log() {
if ( empty( $_REQUEST[ '_wpnonce' ] ) || ! wp_verify_nonce( $_REQUEST[ '_wpnonce' ], 'remove_log' ) ) {
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'remove_log' ) ) {
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
}
if ( ! empty( $_REQUEST[ 'handle' ] ) ) {
if ( ! empty( $_REQUEST['handle'] ) ) {
$logger = wc_get_logger();
$logger->remove( $_REQUEST[ 'handle' ] );
$logger->remove( $_REQUEST['handle'] );
}
wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );

View File

@ -25,7 +25,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
parent::__construct( array(
'singular' => __( 'webhook', 'woocommerce' ),
'plural' => __( 'webhooks', 'woocommerce' ),
'ajax' => false
'ajax' => false,
) );
}
@ -92,7 +92,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
// Get actions
$actions = array(
'id' => sprintf( __( 'ID: %d', 'woocommerce' ), $the_webhook->id )
'id' => sprintf( __( 'ID: %d', 'woocommerce' ), $the_webhook->id ),
);
if ( current_user_can( $post_type_object->cap->edit_post, $the_webhook->id ) && 'trash' !== $post_status ) {
@ -244,12 +244,12 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
if ( isset( $_GET['status'] ) && 'trash' == $_GET['status'] ) {
return array(
'untrash' => __( 'Restore', 'woocommerce' ),
'delete' => __( 'Delete Permanently', 'woocommerce' )
'delete' => __( 'Delete Permanently', 'woocommerce' ),
);
}
return array(
'trash' => __( 'Move to Trash', 'woocommerce' )
'trash' => __( 'Move to Trash', 'woocommerce' ),
);
}
@ -283,7 +283,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
'post_type' => 'shop_webhook',
'posts_per_page' => $per_page,
'ignore_sticky_posts' => true,
'paged' => $current_page
'paged' => $current_page,
);
// Handle the status query
@ -303,7 +303,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
$this->set_pagination_args( array(
'total_items' => $webhooks->found_posts,
'per_page' => $per_page,
'total_pages' => $webhooks->max_num_pages
'total_pages' => $webhooks->max_num_pages,
) );
}
}

View File

@ -196,7 +196,7 @@ class WC_Admin_Webhooks {
'post_author' => get_current_user_id(),
'post_password' => strlen( ( $password = uniqid( 'webhook_' ) ) ) > 20 ? substr( $password, 0, 20 ) : $password,
'post_title' => sprintf( __( 'Webhook created on %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ),
'comment_status' => 'open'
'comment_status' => 'open',
) );
if ( is_wp_error( $webhook_id ) ) {
@ -303,7 +303,7 @@ class WC_Admin_Webhooks {
'ignore_sticky_posts' => true,
'nopaging' => true,
'post_status' => 'trash',
'fields' => 'ids'
'fields' => 'ids',
) );
foreach ( $webhooks as $webhook_id ) {
@ -428,7 +428,7 @@ class WC_Admin_Webhooks {
'post_id' => $webhook->id,
'status' => 'approve',
'type' => 'webhook_delivery',
'number' => 10
'number' => 10,
);
if ( 1 < $current ) {
@ -471,7 +471,7 @@ class WC_Admin_Webhooks {
return array(
'topic' => $topic,
'event' => $event,
'resource' => $resource
'resource' => $resource,
);
}

View File

@ -206,7 +206,7 @@ class WC_Admin {
* @return string
*/
public function admin_footer_text( $footer_text ) {
if ( ! current_user_can( 'manage_woocommerce' ) ) {
if ( ! current_user_can( 'manage_woocommerce' ) || ! function_exists( 'wc_get_screen_ids' ) ) {
return;
}
$current_screen = get_current_screen();

View File

@ -148,14 +148,13 @@ class WC_Tax_Rate_Importer extends WP_Importer {
'tax_rate_compound' => $compound ? 1 : 0,
'tax_rate_shipping' => $shipping ? 1 : 0,
'tax_rate_order' => $loop ++,
'tax_rate_class' => $class
'tax_rate_class' => $class,
);
$tax_rate_id = WC_Tax::_insert_tax_rate( $tax_rate );
WC_Tax::_update_tax_rate_postcodes( $tax_rate_id, wc_clean( $postcode ) );
WC_Tax::_update_tax_rate_cities( $tax_rate_id, wc_clean( $city ) );
}
} else {
$this->import_error( __( 'The CSV is invalid.', 'woocommerce' ) );
}

View File

@ -26,6 +26,8 @@ class WC_Meta_Box_Coupon_Data {
*/
public static function output( $post ) {
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
$coupon = new WC_Coupon( $post->ID );
?>
<style type="text/css">
#edit-slug-box, #minor-publishing-actions { display:none }
@ -51,7 +53,7 @@ class WC_Meta_Box_Coupon_Data {
'label' => __( 'Usage Limits', 'woocommerce' ),
'target' => 'usage_limit_coupon_data',
'class' => '',
)
),
) );
foreach ( $coupon_data_tabs as $key => $tab ) {
@ -70,10 +72,10 @@ class WC_Meta_Box_Coupon_Data {
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => wc_format_localized_price( 0 ), 'description' => __( 'Value of the coupon.', 'woocommerce' ), 'data_type' => 'price', 'desc_tip' => true ) );
// Free Shipping
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Allow free shipping', 'woocommerce' ), 'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://docs.woocommerce.com/document/free-shipping/' ) ) );
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Allow free shipping', 'woocommerce' ), 'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://docs.woocommerce.com/document/free-shipping/' ) ) );
// Expiry date
woocommerce_wp_text_input( array( 'id' => 'expiry_date', 'label' => __( 'Coupon expiry date', 'woocommerce' ), 'placeholder' => _x( 'YYYY-MM-DD', 'placeholder', 'woocommerce' ), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array( 'pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" ) ) );
woocommerce_wp_text_input( array( 'id' => 'expiry_date', 'value' => date( 'Y-m-d', $coupon->get_date_expires() ), 'label' => __( 'Coupon expiry date', 'woocommerce' ), 'placeholder' => _x( 'YYYY-MM-DD', 'placeholder', 'woocommerce' ), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array( 'pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" ) ) );
do_action( 'woocommerce_coupon_options' );
@ -100,7 +102,7 @@ class WC_Meta_Box_Coupon_Data {
?>
<p class="form-field"><label><?php _e( 'Products', 'woocommerce' ); ?></label>
<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="product_ids" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php
$product_ids = array_filter( array_map( 'absint', explode( ',', get_post_meta( $post->ID, 'product_ids', true ) ) ) );
$product_ids = $coupon->get_product_ids();
$json_ids = array();
foreach ( $product_ids as $product_id ) {
@ -118,7 +120,7 @@ class WC_Meta_Box_Coupon_Data {
?>
<p class="form-field"><label><?php _e( 'Exclude products', 'woocommerce' ); ?></label>
<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="exclude_product_ids" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php
$product_ids = array_filter( array_map( 'absint', explode( ',', get_post_meta( $post->ID, 'exclude_product_ids', true ) ) ) );
$product_ids = $coupon->get_excluded_product_ids();
$json_ids = array();
foreach ( $product_ids as $product_id ) {
@ -139,7 +141,7 @@ class WC_Meta_Box_Coupon_Data {
<p class="form-field"><label for="product_categories"><?php _e( 'Product categories', 'woocommerce' ); ?></label>
<select id="product_categories" name="product_categories[]" style="width: 50%;" class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php esc_attr_e( 'Any category', 'woocommerce' ); ?>">
<?php
$category_ids = (array) get_post_meta( $post->ID, 'product_categories', true );
$category_ids = $coupon->get_product_categories();
$categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' );
if ( $categories ) foreach ( $categories as $cat ) {
@ -154,7 +156,7 @@ class WC_Meta_Box_Coupon_Data {
<p class="form-field"><label for="exclude_product_categories"><?php _e( 'Exclude categories', 'woocommerce' ); ?></label>
<select id="exclude_product_categories" name="exclude_product_categories[]" style="width: 50%;" class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php esc_attr_e( 'No categories', 'woocommerce' ); ?>">
<?php
$category_ids = (array) get_post_meta( $post->ID, 'exclude_product_categories', true );
$category_ids = $coupon->get_excluded_product_categories();
$categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' );
if ( $categories ) foreach ( $categories as $cat ) {
@ -167,9 +169,19 @@ class WC_Meta_Box_Coupon_Data {
echo '</div><div class="options_group">';
// Customers
woocommerce_wp_text_input( array( 'id' => 'customer_email', 'label' => __( 'Email restrictions', 'woocommerce' ), 'placeholder' => __( 'No restrictions', 'woocommerce' ), 'description' => __( 'List of allowed emails to check against the customer\'s billing email when an order is placed. Separate email addresses with commas.', 'woocommerce' ), 'value' => implode(', ', (array) get_post_meta( $post->ID, 'customer_email', true ) ), 'desc_tip' => true, 'type' => 'email', 'class' => '', 'custom_attributes' => array(
'multiple' => 'multiple'
) ) );
woocommerce_wp_text_input( array(
'id' => 'customer_email',
'label' => __( 'Email restrictions', 'woocommerce' ),
'placeholder' => __( 'No restrictions', 'woocommerce' ),
'description' => __( 'List of allowed emails to check against the customer\'s billing email when an order is placed. Separate email addresses with commas.', 'woocommerce' ),
'value' => implode(', ', (array) get_post_meta( $post->ID, 'customer_email', true ) ),
'desc_tip' => true,
'type' => 'email',
'class' => '',
'custom_attributes' => array(
'multiple' => 'multiple',
),
) );
echo '</div>';
@ -181,22 +193,52 @@ class WC_Meta_Box_Coupon_Data {
echo '<div class="options_group">';
// Usage limit per coupons
woocommerce_wp_text_input( array( 'id' => 'usage_limit', 'label' => __( 'Usage limit per coupon', 'woocommerce' ), 'placeholder' => _x('Unlimited usage', 'placeholder', 'woocommerce'), 'description' => __( 'How many times this coupon can be used before it is void.', 'woocommerce' ), 'type' => 'number', 'desc_tip' => true, 'class' => 'short', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
woocommerce_wp_text_input( array(
'id' => 'usage_limit',
'label' => __( 'Usage limit per coupon', 'woocommerce' ),
'placeholder' => _x('Unlimited usage', 'placeholder', 'woocommerce'),
'description' => __( 'How many times this coupon can be used before it is void.', 'woocommerce' ),
'type' => 'number',
'desc_tip' => true,
'class' => 'short',
'custom_attributes' => array(
'step' => 1,
'min' => 0,
),
'value' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : '',
) );
// Usage limit per product
woocommerce_wp_text_input( array( 'id' => 'limit_usage_to_x_items', 'label' => __( 'Limit usage to X items', 'woocommerce' ), 'placeholder' => _x( 'Apply to all qualifying items in cart', 'placeholder', 'woocommerce' ), 'description' => __( 'The maximum number of individual items this coupon can apply to when using product discounts. Leave blank to apply to all qualifying items in cart.', 'woocommerce' ), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
woocommerce_wp_text_input( array(
'id' => 'limit_usage_to_x_items',
'label' => __( 'Limit usage to X items', 'woocommerce' ),
'placeholder' => _x( 'Apply to all qualifying items in cart', 'placeholder', 'woocommerce' ),
'description' => __( 'The maximum number of individual items this coupon can apply to when using product discounts. Leave blank to apply to all qualifying items in cart.', 'woocommerce' ),
'desc_tip' => true,
'class' => 'short',
'type' => 'number',
'custom_attributes' => array(
'step' => 1,
'min' => 0,
),
'value' => $coupon->get_limit_usage_to_x_items() ? $coupon->get_limit_usage_to_x_items() : '',
) );
// Usage limit per users
woocommerce_wp_text_input( array( 'id' => 'usage_limit_per_user', 'label' => __( 'Usage limit per user', 'woocommerce' ), 'placeholder' => _x( 'Unlimited usage', 'placeholder', 'woocommerce' ), 'description' => __( 'How many times this coupon can be used by an invidual user. Uses billing email for guests, and user ID for logged in users.', 'woocommerce' ), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
woocommerce_wp_text_input( array(
'id' => 'usage_limit_per_user',
'label' => __( 'Usage limit per user', 'woocommerce' ),
'placeholder' => _x( 'Unlimited usage', 'placeholder', 'woocommerce' ),
'description' => __( 'How many times this coupon can be used by an invidual user. Uses billing email for guests, and user ID for logged in users.', 'woocommerce' ),
'desc_tip' => true,
'class' => 'short',
'type' => 'number',
'custom_attributes' => array(
'step' => 1,
'min' => 0,
),
'value' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : '',
) );
echo '</div>';
@ -218,64 +260,35 @@ class WC_Meta_Box_Coupon_Data {
public static function save( $post_id, $post ) {
global $wpdb;
// Ensure coupon code is correctly formatted
$post->post_title = apply_filters( 'woocommerce_coupon_code', $post->post_title );
$wpdb->update( $wpdb->posts, array( 'post_title' => $post->post_title ), array( 'ID' => $post_id ) );
// Check for dupe coupons
$coupon_found = $wpdb->get_var( $wpdb->prepare( "
SELECT $wpdb->posts.ID
FROM $wpdb->posts
WHERE $wpdb->posts.post_type = 'shop_coupon'
AND $wpdb->posts.post_status = 'publish'
AND $wpdb->posts.post_title = '%s'
AND $wpdb->posts.ID != %s
", $post->post_title, $post_id ) );
$coupon_code = apply_filters( 'woocommerce_coupon_code', $post->post_title );
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $post_id );
if ( $coupon_found ) {
if ( $id_from_code ) {
WC_Admin_Meta_Boxes::add_error( __( 'Coupon code already exists - customers will use the latest coupon with this code.', 'woocommerce' ) );
}
// Add/Replace data to array
$type = wc_clean( $_POST['discount_type'] );
$amount = wc_format_decimal( $_POST['coupon_amount'] );
$usage_limit = empty( $_POST['usage_limit'] ) ? '' : absint( $_POST['usage_limit'] );
$usage_limit_per_user = empty( $_POST['usage_limit_per_user'] ) ? '' : absint( $_POST['usage_limit_per_user'] );
$limit_usage_to_x_items = empty( $_POST['limit_usage_to_x_items'] ) ? '' : absint( $_POST['limit_usage_to_x_items'] );
$individual_use = isset( $_POST['individual_use'] ) ? 'yes' : 'no';
$expiry_date = wc_clean( $_POST['expiry_date'] );
$free_shipping = isset( $_POST['free_shipping'] ) ? 'yes' : 'no';
$exclude_sale_items = isset( $_POST['exclude_sale_items'] ) ? 'yes' : 'no';
$minimum_amount = wc_format_decimal( $_POST['minimum_amount'] );
$maximum_amount = wc_format_decimal( $_POST['maximum_amount'] );
$customer_email = array_filter( array_map( 'trim', explode( ',', wc_clean( $_POST['customer_email'] ) ) ) );
$product_ids = implode( ',', array_filter( array_map( 'intval', explode( ',', $_POST['product_ids'] ) ) ) );
$exclude_product_ids = implode( ',', array_filter( array_map( 'intval', explode( ',', $_POST['exclude_product_ids'] ) ) ) );
$product_categories = isset( $_POST['product_categories'] ) ? array_map( 'intval', $_POST['product_categories'] ) : array();
$exclude_product_categories = isset( $_POST['exclude_product_categories'] ) ? array_map( 'intval', $_POST['exclude_product_categories'] ) : array();
// Save
update_post_meta( $post_id, 'discount_type', $type );
update_post_meta( $post_id, 'coupon_amount', $amount );
update_post_meta( $post_id, 'individual_use', $individual_use );
update_post_meta( $post_id, 'product_ids', $product_ids );
update_post_meta( $post_id, 'exclude_product_ids', $exclude_product_ids );
update_post_meta( $post_id, 'usage_limit', $usage_limit );
update_post_meta( $post_id, 'usage_limit_per_user', $usage_limit_per_user );
update_post_meta( $post_id, 'limit_usage_to_x_items', $limit_usage_to_x_items );
update_post_meta( $post_id, 'expiry_date', $expiry_date );
update_post_meta( $post_id, 'free_shipping', $free_shipping );
update_post_meta( $post_id, 'exclude_sale_items', $exclude_sale_items );
update_post_meta( $post_id, 'product_categories', $product_categories );
update_post_meta( $post_id, 'exclude_product_categories', $exclude_product_categories );
update_post_meta( $post_id, 'minimum_amount', $minimum_amount );
update_post_meta( $post_id, 'maximum_amount', $maximum_amount );
update_post_meta( $post_id, 'customer_email', $customer_email );
// Clear cache
WC_Cache_Helper::incr_cache_prefix( 'coupons' );
$coupon = new WC_Coupon( $post_id );
$coupon->set_props( array(
'code' => $post->post_title,
'discount_type' => wc_clean( $_POST['discount_type'] ),
'amount' => wc_format_decimal( $_POST['coupon_amount'] ),
'date_expires' => wc_clean( $_POST['expiry_date'] ),
'individual_use' => isset( $_POST['individual_use'] ),
'product_ids' => array_filter( array_map( 'intval', explode( ',', $_POST['product_ids'] ) ) ),
'excluded_product_ids' => array_filter( array_map( 'intval', explode( ',', $_POST['exclude_product_ids'] ) ) ),
'usage_limit' => absint( $_POST['usage_limit'] ),
'usage_limit_per_user' => absint( $_POST['usage_limit_per_user'] ),
'limit_usage_to_x_items' => absint( $_POST['limit_usage_to_x_items'] ),
'free_shipping' => isset( $_POST['free_shipping'] ),
'product_categories' => array_filter( array_map( 'intval', (array) $_POST['product_categories'] ) ),
'excluded_product_categories' => array_filter( array_map( 'intval', (array) $_POST['exclude_product_categories'] ) ),
'exclude_sale_items' => isset( $_POST['exclude_sale_items'] ),
'minimum_amount' => wc_format_decimal( $_POST['minimum_amount'] ),
'maximum_amount' => wc_format_decimal( $_POST['maximum_amount'] ),
'email_restrictions' => array_filter( array_map( 'trim', explode( ',', wc_clean( $_POST['customer_email'] ) ) ) ),
) );
$coupon->save();
do_action( 'woocommerce_coupon_options_save', $post_id );
}
}

View File

@ -59,7 +59,7 @@ class WC_Meta_Box_Order_Actions {
<option value="regenerate_download_permissions"><?php _e( 'Regenerate download permissions', 'woocommerce' ); ?></option>
<?php foreach( apply_filters( 'woocommerce_order_actions', array() ) as $action => $title ) { ?>
<?php foreach ( apply_filters( 'woocommerce_order_actions', array() ) as $action => $title ) { ?>
<option value="<?php echo $action; ?>"><?php echo $title; ?></option>
<?php } ?>
</select>
@ -139,7 +139,7 @@ class WC_Meta_Box_Order_Actions {
} elseif ( 'regenerate_download_permissions' === $action ) {
delete_post_meta( $post_id, '_download_permissions_granted' );
$wpdb->delete(
$wpdb->delete(
$wpdb->prefix . 'woocommerce_downloadable_product_permissions',
array( 'order_id' => $post_id ),
array( '%d' )
@ -169,5 +169,4 @@ class WC_Meta_Box_Order_Actions {
public static function set_email_sent_message( $location ) {
return add_query_arg( 'message', 11, $location );
}
}

View File

@ -41,43 +41,43 @@ class WC_Meta_Box_Order_Data {
self::$billing_fields = apply_filters( 'woocommerce_admin_billing_fields', array(
'first_name' => array(
'label' => __( 'First Name', 'woocommerce' ),
'show' => false
'show' => false,
),
'last_name' => array(
'label' => __( 'Last Name', 'woocommerce' ),
'show' => false
'show' => false,
),
'company' => array(
'label' => __( 'Company', 'woocommerce' ),
'show' => false
'show' => false,
),
'address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'show' => false
'show' => false,
),
'address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'show' => false
'show' => false,
),
'city' => array(
'label' => __( 'City', 'woocommerce' ),
'show' => false
'show' => false,
),
'postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'show' => false
'show' => false,
),
'country' => array(
'label' => __( 'Country', 'woocommerce' ),
'show' => false,
'class' => 'js_field-country select short',
'type' => 'select',
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries()
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'class' => 'js_field-state select short',
'show' => false
'show' => false,
),
'email' => array(
'label' => __( 'Email', 'woocommerce' ),
@ -90,43 +90,43 @@ class WC_Meta_Box_Order_Data {
self::$shipping_fields = apply_filters( 'woocommerce_admin_shipping_fields', array(
'first_name' => array(
'label' => __( 'First Name', 'woocommerce' ),
'show' => false
'show' => false,
),
'last_name' => array(
'label' => __( 'Last Name', 'woocommerce' ),
'show' => false
'show' => false,
),
'company' => array(
'label' => __( 'Company', 'woocommerce' ),
'show' => false
'show' => false,
),
'address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'show' => false
'show' => false,
),
'address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'show' => false
'show' => false,
),
'city' => array(
'label' => __( 'City', 'woocommerce' ),
'show' => false
'show' => false,
),
'postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'show' => false
'show' => false,
),
'country' => array(
'label' => __( 'Country', 'woocommerce' ),
'show' => false,
'type' => 'select',
'class' => 'js_field-country select short',
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_shipping_countries()
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_shipping_countries(),
),
'state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'class' => 'js_field-state select short',
'show' => false
'show' => false,
),
) );
}
@ -220,9 +220,10 @@ class WC_Meta_Box_Order_Data {
<p class="form-field form-field-wide wc-customer-user">
<label for="customer_user"><?php _e( 'Customer:', 'woocommerce' ) ?> <?php
if ( $order->get_user_id() ) {
$args = array( 'post_status' => 'all',
$args = array(
'post_status' => 'all',
'post_type' => 'shop_order',
'_customer_user' => absint( $order->get_user_id() )
'_customer_user' => absint( $order->get_user_id() ),
);
printf( '<a href="%s">%s &rarr;</a>',
esc_url( add_query_arg( $args, admin_url( 'edit.php' ) ) ),
@ -280,7 +281,7 @@ class WC_Meta_Box_Order_Data {
if ( ! isset( $field['type'] ) ) {
$field['type'] = 'text';
}
if ( ! isset( $field['id'] ) ){
if ( ! isset( $field['id'] ) ) {
$field['id'] = '_billing_' . $key;
}
switch ( $field['type'] ) {
@ -372,7 +373,7 @@ class WC_Meta_Box_Order_Data {
if ( ! isset( $field['type'] ) ) {
$field['type'] = 'text';
}
if ( ! isset( $field['id'] ) ){
if ( ! isset( $field['id'] ) ) {
$field['id'] = '_shipping_' . $key;
}
@ -433,7 +434,7 @@ class WC_Meta_Box_Order_Data {
if ( ! empty( self::$billing_fields ) ) {
foreach ( self::$billing_fields as $key => $field ) {
if ( ! isset( $field['id'] ) ){
if ( ! isset( $field['id'] ) ) {
$field['id'] = '_billing_' . $key;
}
if ( update_post_meta( $post_id, $field['id'], wc_clean( $_POST[ $field['id'] ] ) ) ) {
@ -444,7 +445,7 @@ class WC_Meta_Box_Order_Data {
if ( ! empty( self::$shipping_fields ) ) {
foreach ( self::$shipping_fields as $key => $field ) {
if ( ! isset( $field['id'] ) ){
if ( ! isset( $field['id'] ) ) {
$field['id'] = '_shipping_' . $key;
}
if ( update_post_meta( $post_id, $field['id'], wc_clean( $_POST[ $field['id'] ] ) ) ) {
@ -454,7 +455,7 @@ class WC_Meta_Box_Order_Data {
}
if ( isset( $_POST['_transaction_id'] ) ) {
update_post_meta( $post_id, '_transaction_id', wc_clean( $_POST[ '_transaction_id' ] ) );
update_post_meta( $post_id, '_transaction_id', wc_clean( $_POST['_transaction_id'] ) );
}
// Payment method handling

View File

@ -121,7 +121,7 @@ class WC_Meta_Box_Order_Downloads {
array(
'order_id' => $post_id,
'product_id' => absint( $product_ids[ $i ] ),
'download_id' => wc_clean( $download_ids[ $i ] )
'download_id' => wc_clean( $download_ids[ $i ] ),
),
$format, array( '%d', '%d', '%s' )
);

View File

@ -30,7 +30,7 @@ class WC_Meta_Box_Order_Notes {
'orderby' => 'comment_ID',
'order' => 'DESC',
'approve' => 'approve',
'type' => 'order_note'
'type' => 'order_note',
);
remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
@ -43,7 +43,7 @@ class WC_Meta_Box_Order_Notes {
if ( $notes ) {
foreach( $notes as $note ) {
foreach ( $notes as $note ) {
$note_classes = array( 'note' );
$note_classes[] = get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ? 'customer-note' : '';
@ -62,7 +62,6 @@ class WC_Meta_Box_Order_Notes {
</li>
<?php
}
} else {
echo '<li>' . __( 'There are no notes yet.', 'woocommerce' ) . '</li>';
}

View File

@ -51,15 +51,15 @@ class WC_Meta_Box_Product_Data {
'wrapper_class' => 'show_if_simple',
'label' => __( 'Virtual', 'woocommerce' ),
'description' => __( 'Virtual products are intangible and aren\'t shipped.', 'woocommerce' ),
'default' => 'no'
'default' => 'no',
),
'downloadable' => array(
'id' => '_downloadable',
'wrapper_class' => 'show_if_simple',
'label' => __( 'Downloadable', 'woocommerce' ),
'description' => __( 'Downloadable products give access to a file upon purchase.', 'woocommerce' ),
'default' => 'no'
)
'default' => 'no',
),
) );
foreach ( $product_type_options as $key => $option ) {
@ -114,7 +114,7 @@ class WC_Meta_Box_Product_Data {
'label' => __( 'Advanced', 'woocommerce' ),
'target' => 'advanced_product_data',
'class' => array(),
)
),
) );
foreach ( $product_data_tabs as $key => $tab ) {
@ -192,7 +192,7 @@ class WC_Meta_Box_Product_Data {
<a href="#" class="button insert" data-row="<?php
$file = array(
'file' => '',
'name' => ''
'name' => '',
);
ob_start();
include( 'views/html-product-download.php' );
@ -206,23 +206,42 @@ class WC_Meta_Box_Product_Data {
<?php
// Download Limit
woocommerce_wp_text_input( array( 'id' => '_download_limit', 'label' => __( 'Download limit', 'woocommerce' ), 'placeholder' => __( 'Unlimited', 'woocommerce' ), 'description' => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
woocommerce_wp_text_input( array(
'id' => '_download_limit',
'label' => __( 'Download limit', 'woocommerce' ),
'placeholder' => __( 'Unlimited', 'woocommerce' ),
'description' => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ),
'type' => 'number',
'custom_attributes' => array(
'step' => '1',
'min' => '0',
),
) );
// Expirey
woocommerce_wp_text_input( array( 'id' => '_download_expiry', 'label' => __( 'Download expiry', 'woocommerce' ), 'placeholder' => __( 'Never', 'woocommerce' ), 'description' => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
woocommerce_wp_text_input( array(
'id' => '_download_expiry',
'label' => __( 'Download expiry', 'woocommerce' ),
'placeholder' => __( 'Never', 'woocommerce' ),
'description' => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ),
'type' => 'number',
'custom_attributes' => array(
'step' => '1',
'min' => '0',
),
) );
// Download Type
woocommerce_wp_select( array( 'id' => '_download_type', 'label' => __( 'Download type', 'woocommerce' ), 'description' => sprintf( __( 'Choose a download type - this controls the <a href="%s">schema</a>.', 'woocommerce' ), 'http://schema.org/' ), 'options' => array(
'' => __( 'Standard Product', 'woocommerce' ),
'application' => __( 'Application/Software', 'woocommerce' ),
'music' => __( 'Music', 'woocommerce' ),
) ) );
woocommerce_wp_select( array(
'id' => '_download_type',
'label' => __( 'Download type', 'woocommerce' ),
'description' => sprintf( __( 'Choose a download type - this controls the <a href="%s">schema</a>.', 'woocommerce' ), 'http://schema.org/' ),
'options' => array(
'' => __( 'Standard Product', 'woocommerce' ),
'application' => __( 'Application/Software', 'woocommerce' ),
'music' => __( 'Music', 'woocommerce' ),
),
) );
do_action( 'woocommerce_product_options_downloads' );
@ -239,10 +258,10 @@ class WC_Meta_Box_Product_Data {
'options' => array(
'taxable' => __( 'Taxable', 'woocommerce' ),
'shipping' => __( 'Shipping only', 'woocommerce' ),
'none' => _x( 'None', 'Tax status', 'woocommerce' )
'none' => _x( 'None', 'Tax status', 'woocommerce' ),
),
'desc_tip' => 'true',
'description' => __( 'Define whether or not the entire product is taxable, or just the cost of shipping it.', 'woocommerce' )
'description' => __( 'Define whether or not the entire product is taxable, or just the cost of shipping it.', 'woocommerce' ),
) );
$tax_classes = WC_Tax::get_tax_classes();
@ -260,7 +279,7 @@ class WC_Meta_Box_Product_Data {
'label' => __( 'Tax class', 'woocommerce' ),
'options' => $classes_options,
'desc_tip' => 'true',
'description' => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' )
'description' => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' ),
) );
do_action( 'woocommerce_product_options_tax' );
@ -305,17 +324,23 @@ class WC_Meta_Box_Product_Data {
'description' => __( 'Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce' ),
'type' => 'number',
'custom_attributes' => array(
'step' => 'any'
'step' => 'any',
),
'data_type' => 'stock'
'data_type' => 'stock',
) );
// Backorders?
woocommerce_wp_select( array( 'id' => '_backorders', 'label' => __( 'Allow backorders?', 'woocommerce' ), 'options' => array(
'no' => __( 'Do not allow', 'woocommerce' ),
'notify' => __( 'Allow, but notify customer', 'woocommerce' ),
'yes' => __( 'Allow', 'woocommerce' )
), 'desc_tip' => true, 'description' => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ) ) );
woocommerce_wp_select( array(
'id' => '_backorders',
'label' => __( 'Allow backorders?', 'woocommerce' ),
'options' => array(
'no' => __( 'Do not allow', 'woocommerce' ),
'notify' => __( 'Allow, but notify customer', 'woocommerce' ),
'yes' => __( 'Allow', 'woocommerce' ),
),
'desc_tip' => true,
'description' => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ),
) );
do_action( 'woocommerce_product_options_stock_fields' );
@ -324,10 +349,17 @@ class WC_Meta_Box_Product_Data {
}
// Stock status
woocommerce_wp_select( array( 'id' => '_stock_status', 'wrapper_class' => 'hide_if_variable hide_if_external', 'label' => __( 'Stock status', 'woocommerce' ), 'options' => array(
'instock' => __( 'In stock', 'woocommerce' ),
'outofstock' => __( 'Out of stock', 'woocommerce' )
), 'desc_tip' => true, 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ) ) );
woocommerce_wp_select( array(
'id' => '_stock_status',
'wrapper_class' => 'hide_if_variable hide_if_external',
'label' => __( 'Stock status', 'woocommerce' ),
'options' => array(
'instock' => __( 'In stock', 'woocommerce' ),
'outofstock' => __( 'Out of stock', 'woocommerce' ),
),
'desc_tip' => true,
'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
) );
do_action( 'woocommerce_product_options_stock_status' );
@ -392,7 +424,7 @@ class WC_Meta_Box_Product_Data {
'name' => 'product_shipping_class',
'id' => 'product_shipping_class',
'selected' => $current_shipping_class,
'class' => 'select short'
'class' => 'select short',
);
?><p class="form-field dimensions_field"><label for="product_shipping_class"><?php _e( 'Shipping class', 'woocommerce' ); ?></label> <?php wp_dropdown_categories( $args ); ?> <?php echo wc_help_tip( __( 'Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce' ) ); ?></p><?php
@ -550,9 +582,17 @@ class WC_Meta_Box_Product_Data {
<div class="options_group">
<?php
// menu_order
woocommerce_wp_text_input( array( 'id' => 'menu_order', 'label' => __( 'Menu order', 'woocommerce' ), 'desc_tip' => 'true', 'description' => __( 'Custom ordering position.', 'woocommerce' ), 'value' => intval( $post->menu_order ), 'type' => 'number', 'custom_attributes' => array(
'step' => '1'
) ) );
woocommerce_wp_text_input( array(
'id' => 'menu_order',
'label' => __( 'Menu order', 'woocommerce' ),
'desc_tip' => 'true',
'description' => __( 'Custom ordering position.', 'woocommerce' ),
'value' => intval( $post->menu_order ),
'type' => 'number',
'custom_attributes' => array(
'step' => '1',
),
) );
?>
</div>
@ -645,7 +685,6 @@ class WC_Meta_Box_Product_Data {
foreach ( $post_terms as $term ) {
echo '<option ' . selected( $variation_selected_value, $term->slug, false ) . ' value="' . esc_attr( $term->slug ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ) . '</option>';
}
} else {
$options = wc_get_text_attributes( $attribute['value'] );
@ -653,7 +692,6 @@ class WC_Meta_Box_Product_Data {
$selected = sanitize_title( $variation_selected_value ) === $variation_selected_value ? selected( $variation_selected_value, sanitize_title( $option ), false ) : selected( $variation_selected_value, $option, false );
echo '<option ' . $selected . ' value="' . esc_attr( $option ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>';
}
}
echo '</select>';
@ -819,7 +857,6 @@ class WC_Meta_Box_Product_Data {
if ( isset( $_POST['_height'] ) ) {
update_post_meta( $post_id, '_height', ( '' === $_POST['_height'] ) ? '' : wc_format_decimal( $_POST['_height'] ) );
}
} else {
update_post_meta( $post_id, '_weight', '' );
update_post_meta( $post_id, '_length', '' );
@ -906,7 +943,7 @@ class WC_Meta_Box_Product_Data {
// Update post terms
if ( taxonomy_exists( $attribute_names[ $i ] ) ) {
foreach( $values as $key => $value ) {
foreach ( $values as $key => $value ) {
$term = get_term_by( $values_are_slugs ? 'slug' : 'name', trim( $value ), $attribute_names[ $i ] );
if ( $term ) {
@ -930,10 +967,9 @@ class WC_Meta_Box_Product_Data {
'position' => $attribute_position[ $i ],
'is_visible' => $is_visible,
'is_variation' => $is_variation,
'is_taxonomy' => $is_taxonomy
'is_taxonomy' => $is_taxonomy,
);
}
} elseif ( isset( $attribute_values[ $i ] ) ) {
// Text based, possibly separated by pipes (WC_DELIMITER). Preserve line breaks in non-variation attributes.
@ -947,7 +983,7 @@ class WC_Meta_Box_Product_Data {
'position' => $attribute_position[ $i ],
'is_visible' => $is_visible,
'is_variation' => $is_variation,
'is_taxonomy' => $is_taxonomy
'is_taxonomy' => $is_taxonomy,
);
}
}
@ -1044,7 +1080,7 @@ class WC_Meta_Box_Product_Data {
'meta_key' => '_price',
'posts_per_page' => 1,
'post_type' => 'product',
'fields' => 'ids'
'fields' => 'ids',
) );
if ( $children_by_price ) {
@ -1086,7 +1122,6 @@ class WC_Meta_Box_Product_Data {
$manage_stock = 'yes';
$backorders = wc_clean( $_POST['_backorders'] );
}
} elseif ( 'grouped' !== $product_type && ! empty( $_POST['_manage_stock'] ) ) {
$manage_stock = 'yes';
$backorders = wc_clean( $_POST['_backorders'] );
@ -1104,7 +1139,6 @@ class WC_Meta_Box_Product_Data {
} else {
update_post_meta( $post_id, '_stock', '' );
}
} elseif ( 'variable' !== $product_type ) {
wc_update_product_stock_status( $post_id, wc_clean( $_POST['_stock_status'] ) );
}
@ -1182,7 +1216,7 @@ class WC_Meta_Box_Product_Data {
$files[ $file_hash ] = array(
'name' => $file_name,
'file' => $file_url
'file' => $file_url,
);
}
}
@ -1298,7 +1332,7 @@ class WC_Meta_Box_Product_Data {
'post_author' => get_current_user_id(),
'post_parent' => $post_id,
'post_type' => 'product_variation',
'menu_order' => $variable_menu_order[ $i ]
'menu_order' => $variable_menu_order[ $i ],
);
$variation_id = wp_insert_post( $variation );
@ -1314,7 +1348,7 @@ class WC_Meta_Box_Product_Data {
'post_title' => $variation_post_title,
'menu_order' => $variable_menu_order[ $i ],
'post_modified' => $modified_date,
'post_modified_gmt' => get_gmt_from_date( $modified_date )
'post_modified_gmt' => get_gmt_from_date( $modified_date ),
), array( 'ID' => $variation_id ) );
clean_post_cache( $variation_id );
@ -1472,7 +1506,7 @@ class WC_Meta_Box_Product_Data {
$files[ $file_hash ] = array(
'name' => $file_name,
'file' => $file_url
'file' => $file_url,
);
}
}

View File

@ -33,10 +33,9 @@ class WC_Meta_Box_Product_Short_Description {
'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
'theme_advanced_buttons2' => '',
),
'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>'
'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
);
wp_editor( htmlspecialchars_decode( $post->post_excerpt ), 'excerpt', apply_filters( 'woocommerce_product_short_description_editor_settings', $settings ) );
}
}

View File

@ -29,11 +29,11 @@ if ( ! defined( 'ABSPATH' ) ) {
<td>
<label><?php _e( 'Customer download link', 'woocommerce' ); ?></label>
<?php
$download_link = add_query_arg( array(
$download_link = add_query_arg( array(
'download_file' => $download->product_id,
'order' => $download->order_key,
'email' => urlencode( $download->user_email ),
'key' => $download->download_id
'key' => $download->download_id,
), trailingslashit( home_url() ) );
echo '<a href="' . esc_url( $download_link ) . '">' . esc_html( $file_count ) . '</a>';

View File

@ -13,7 +13,7 @@
'_line_total',
'_line_tax',
'method_id',
'cost'
'cost',
) ) ) ) {
continue;
}
@ -42,7 +42,7 @@
'_line_total',
'_line_tax',
'method_id',
'cost'
'cost',
) ) ) ) {
continue;
}

View File

@ -31,7 +31,7 @@
<?php
$args = array(
'orderby' => 'name',
'hide_empty' => 0
'hide_empty' => 0,
);
$all_terms = get_terms( $taxonomy, apply_filters( 'woocommerce_product_attribute_terms', $args ) );
if ( $all_terms ) {

View File

@ -4,4 +4,4 @@
<td class="file_url"><input type="text" class="input_text" placeholder="<?php esc_attr_e( "http://", 'woocommerce' ); ?>" name="_wc_file_urls[]" value="<?php echo esc_attr( $file['file'] ); ?>" /></td>
<td class="file_url_choose" width="1%"><a href="#" class="button upload_file_button" data-choose="<?php esc_attr_e( 'Choose file', 'woocommerce' ); ?>" data-update="<?php esc_attr_e( 'Insert file URL', 'woocommerce' ); ?>"><?php echo str_replace( ' ', '&nbsp;', __( 'Choose file', 'woocommerce' ) ); ?></a></td>
<td width="1%"><a href="#" class="delete"><?php _e( 'Delete', 'woocommerce' ); ?></a></td>
</tr>
</tr>

View File

@ -3,4 +3,4 @@
<td class="file_url"><input type="text" class="input_text" placeholder="<?php esc_attr_e( "http://", 'woocommerce' ); ?>" name="_wc_variation_file_urls[<?php echo $variation_id; ?>][]" value="<?php echo esc_attr( $file['file'] ); ?>" /></td>
<td class="file_url_choose" width="1%"><a href="#" class="button upload_file_button" data-choose="<?php esc_attr_e( 'Choose file', 'woocommerce' ); ?>" data-update="<?php esc_attr_e( 'Insert file URL', 'woocommerce' ); ?>"><?php echo str_replace( ' ', '&nbsp;', __( 'Choose file', 'woocommerce' ) ); ?></a></td>
<td width="1%"><a href="#" class="delete"><?php _e( 'Delete', 'woocommerce' ); ?></a></td>
</tr>
</tr>

View File

@ -40,7 +40,6 @@ extract( $variation_data );
foreach ( $post_terms as $term ) {
echo '<option ' . selected( $variation_selected_value, $term->slug, false ) . ' value="' . esc_attr( $term->slug ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ) . '</option>';
}
} else {
$options = wc_get_text_attributes( $attribute['value'] );
@ -49,7 +48,6 @@ extract( $variation_data );
$selected = sanitize_title( $variation_selected_value ) === $variation_selected_value ? selected( $variation_selected_value, sanitize_title( $option ), false ) : selected( $variation_selected_value, $option, false );
echo '<option ' . $selected . ' value="' . esc_attr( $option ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>';
}
}
echo '</select>';
@ -212,7 +210,7 @@ extract( $variation_data );
'name' => 'variable_shipping_class[' . $loop . ']',
'id' => '',
'selected' => isset( $shipping_class ) ? esc_attr( $shipping_class ) : '',
'echo' => 0
'echo' => 0,
);
echo wp_dropdown_categories( $args );
@ -267,7 +265,7 @@ extract( $variation_data );
if ( ! is_array( $file ) ) {
$file = array(
'file' => $file,
'name' => ''
'name' => '',
);
}
include( 'html-product-variation-download.php' );
@ -281,7 +279,7 @@ extract( $variation_data );
<a href="#" class="button insert" data-row="<?php
$file = array(
'file' => '',
'name' => ''
'name' => '',
);
ob_start();
include( 'html-product-variation-download.php' );

View File

@ -152,10 +152,10 @@ class WC_Admin_Report {
switch ( $type ) {
case 'meta' :
$joins["meta_{$key}"] = "{$join_type} JOIN {$wpdb->postmeta} AS meta_{$key} ON ( posts.ID = meta_{$key}.post_id AND meta_{$key}.meta_key = '{$key}' )";
$joins[ "meta_{$key}" ] = "{$join_type} JOIN {$wpdb->postmeta} AS meta_{$key} ON ( posts.ID = meta_{$key}.post_id AND meta_{$key}.meta_key = '{$key}' )";
break;
case 'parent_meta' :
$joins["parent_meta_{$key}"] = "{$join_type} JOIN {$wpdb->postmeta} AS parent_meta_{$key} ON (posts.post_parent = parent_meta_{$key}.post_id) AND (parent_meta_{$key}.meta_key = '{$key}')";
$joins[ "parent_meta_{$key}" ] = "{$join_type} JOIN {$wpdb->postmeta} AS parent_meta_{$key} ON (posts.post_parent = parent_meta_{$key}.post_id) AND (parent_meta_{$key}.meta_key = '{$key}')";
break;
case 'order_item_meta' :
$joins["order_items"] = "{$join_type} JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON (posts.ID = order_items.order_id)";
@ -164,7 +164,7 @@ class WC_Admin_Report {
$joins["order_items"] .= " AND (order_items.order_item_type = '{$value['order_item_type']}')";
}
$joins["order_item_meta_{$key}"] = "{$join_type} JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_{$key} ON " .
$joins[ "order_item_meta_{$key}" ] = "{$join_type} JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_{$key} ON " .
"(order_items.order_item_id = order_item_meta_{$key}.order_item_id) " .
" AND (order_item_meta_{$key}.meta_key = '{$key}')";
break;
@ -186,11 +186,11 @@ class WC_Admin_Report {
if ( 'order_item_meta' === $type ) {
$joins["order_items"] = "{$join_type} JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_items.order_id";
$joins["order_item_meta_{$key}"] = "{$join_type} JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_{$key} ON order_items.order_item_id = order_item_meta_{$key}.order_item_id";
$joins[ "order_item_meta_{$key}" ] = "{$join_type} JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_{$key} ON order_items.order_item_id = order_item_meta_{$key}.order_item_id";
} else {
// If we have a where clause for meta, join the postmeta table
$joins["meta_{$key}"] = "{$join_type} JOIN {$wpdb->postmeta} AS meta_{$key} ON posts.ID = meta_{$key}.post_id";
$joins[ "meta_{$key}" ] = "{$join_type} JOIN {$wpdb->postmeta} AS meta_{$key} ON posts.ID = meta_{$key}.post_id";
}
}
}
@ -227,7 +227,6 @@ class WC_Admin_Report {
";
}
if ( ! empty( $where_meta ) ) {
$relation = isset( $where_meta['relation'] ) ? $where_meta['relation'] : 'AND';
@ -417,35 +416,35 @@ class WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => '',
'name' => 'product_id'
'name' => 'product_id',
),
$meta_key => array(
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'sparkline_value'
'name' => 'sparkline_value',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where' => array(
array(
'key' => 'post_date',
'value' => date( 'Y-m-d', strtotime( 'midnight -' . ( $days - 1 ) . ' days', current_time( 'timestamp' ) ) ),
'operator' => '>'
'operator' => '>',
),
array(
'key' => 'order_item_meta__product_id.meta_value',
'value' => $id,
'operator' => '='
)
'operator' => '=',
),
),
'group_by' => 'YEAR(posts.post_date), MONTH(posts.post_date), DAY(posts.post_date)',
'query_type' => 'get_results',
'filter_range' => false
'filter_range' => false,
) );
} else {
@ -454,24 +453,24 @@ class WC_Admin_Report {
'_order_total' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'sparkline_value'
'name' => 'sparkline_value',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where' => array(
array(
'key' => 'post_date',
'value' => date( 'Y-m-d', strtotime( 'midnight -' . ( $days - 1 ) . ' days', current_time( 'timestamp' ) ) ),
'operator' => '>'
)
'operator' => '>',
),
),
'group_by' => 'YEAR(posts.post_date), MONTH(posts.post_date), DAY(posts.post_date)',
'query_type' => 'get_results',
'filter_range' => false
'filter_range' => false,
) );
}
@ -488,7 +487,7 @@ class WC_Admin_Report {
$sparkline_data = array_values( $this->prepare_chart_data( $data, 'post_date', 'sparkline_value', $days - 1, strtotime( 'midnight -' . ( $days - 1 ) . ' days', current_time( 'timestamp' ) ), 'day' ) );
return '<span class="wc_sparkline ' . ( $type == 'sales' ? 'lines' : 'bars' ) . ' tips" data-color="#777" data-tip="' . esc_attr( $tooltip ) . '" data-barwidth="' . 60*60*16*1000 . '" data-sparkline="' . esc_attr( json_encode( $sparkline_data ) ) . '"></span>';
return '<span class="wc_sparkline ' . ( $type == 'sales' ? 'lines' : 'bars' ) . ' tips" data-color="#777" data-tip="' . esc_attr( $tooltip ) . '" data-barwidth="' . 60 * 60 * 16 * 1000 . '" data-sparkline="' . esc_attr( json_encode( $sparkline_data ) ) . '"></span>';
}
/**
@ -578,7 +577,7 @@ class WC_Admin_Report {
* @return string
*/
public function get_currency_tooltip() {
switch( get_option( 'woocommerce_currency_pos' ) ) {
switch ( get_option( 'woocommerce_currency_pos' ) ) {
case 'right':
$currency_tooltip = 'append_tooltip: "' . get_woocommerce_currency_symbol() . '"'; break;
case 'right_space':

View File

@ -53,15 +53,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'coupon',
'function' => 'SUM',
'name' => 'discount_amount'
)
'name' => 'discount_amount',
),
),
'where' => array(
array(
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'query_type' => 'get_var',
'filter_range' => true,
@ -74,15 +74,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item',
'order_item_type' => 'coupon',
'function' => 'COUNT',
'name' => 'order_coupon_count'
)
'name' => 'order_coupon_count',
),
),
'where' => array(
array(
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'query_type' => 'get_var',
'filter_range' => true,
@ -94,7 +94,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item',
'key' => 'order_item_name',
'value' => $this->coupon_codes,
'operator' => 'IN'
'operator' => 'IN',
);
$total_discount_query['where'][] = $coupon_code_query;
@ -107,13 +107,13 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
$legend[] = array(
'title' => sprintf( __( '%s discounts in total', 'woocommerce' ), '<strong>' . wc_price( $total_discount ) . '</strong>' ),
'color' => $this->chart_colours['discount_amount'],
'highlight_series' => 1
'highlight_series' => 1,
);
$legend[] = array(
'title' => sprintf( __( '%s coupons used in total', 'woocommerce' ), '<strong>' . $total_coupons . '</strong>' ),
'color' => $this->chart_colours['coupon_count' ],
'highlight_series' => 0
'color' => $this->chart_colours['coupon_count'],
'highlight_series' => 0,
);
return $legend;
@ -128,7 +128,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
'month' => __( 'This Month', 'woocommerce' ),
'7day' => __( 'Last 7 Days', 'woocommerce' )
'7day' => __( 'Last 7 Days', 'woocommerce' ),
);
$this->chart_colours = array(
@ -157,7 +157,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
$widgets[] = array(
'title' => '',
'callback' => array( $this, 'coupons_widget' )
'callback' => array( $this, 'coupons_widget' ),
);
return $widgets;
@ -180,18 +180,18 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'order_item_type' => 'coupon',
'function' => '',
'distinct' => true,
'name' => 'order_item_name'
)
'name' => 'order_item_name',
),
),
'where' => array(
array(
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'query_type' => 'get_col',
'filter_range' => false
'filter_range' => false,
) );
if ( ! empty( $used_coupons ) && is_array( $used_coupons ) ) :
@ -227,13 +227,13 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item',
'order_item_type' => 'coupon',
'function' => '',
'name' => 'coupon_code'
'name' => 'coupon_code',
),
'order_item_id' => array(
'type' => 'order_item',
'order_item_type' => 'coupon',
'function' => 'COUNT',
'name' => 'coupon_count'
'name' => 'coupon_count',
),
),
'where' => array(
@ -241,14 +241,14 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item',
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'order_by' => 'coupon_count DESC',
'group_by' => 'order_item_name',
'limit' => 12,
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
if ( ! empty( $most_popular ) && is_array( $most_popular ) ) {
@ -274,28 +274,28 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item',
'order_item_type' => 'coupon',
'function' => '',
'name' => 'coupon_code'
'name' => 'coupon_code',
),
'discount_amount' => array(
'type' => 'order_item_meta',
'order_item_type' => 'coupon',
'function' => 'SUM',
'name' => 'discount_amount'
)
'name' => 'discount_amount',
),
),
'where' => array(
array(
'type' => 'order_item',
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'order_by' => 'discount_amount DESC',
'group_by' => 'order_item_name',
'limit' => 12,
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
if ( ! empty( $most_discount ) && is_array( $most_discount ) ) {
@ -369,26 +369,26 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item',
'order_item_type' => 'coupon',
'function' => 'COUNT',
'name' => 'order_coupon_count'
'name' => 'order_coupon_count',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where' => array(
array(
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'group_by' => $this->group_by_query,
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true,
'order_types' => wc_get_order_types( 'order-count' )
'order_types' => wc_get_order_types( 'order-count' ),
);
$order_discount_amounts_query = array(
@ -397,26 +397,26 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'coupon',
'function' => 'SUM',
'name' => 'discount_amount'
'name' => 'discount_amount',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where' => array(
array(
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'group_by' => $this->group_by_query . ', order_item_name',
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true,
'order_types' => wc_get_order_types( 'order-count' )
'order_types' => wc_get_order_types( 'order-count' ),
);
if ( ! empty( $this->coupon_codes ) ) {
@ -424,7 +424,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'type' => 'order_item',
'key' => 'order_item_name',
'value' => $this->coupon_codes,
'operator' => 'IN'
'operator' => 'IN',
);
$order_coupon_counts_query['where'][] = $coupon_code_query;
@ -441,7 +441,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
// Encode in json format
$chart_data = json_encode( array(
'order_coupon_counts' => array_values( $order_coupon_counts ),
'order_discount_amounts' => array_values( $order_discount_amounts )
'order_discount_amounts' => array_values( $order_discount_amounts ),
) );
?>
<div class="chart-container">
@ -458,8 +458,8 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
{
label: "<?php echo esc_js( __( 'Number of coupons used', 'woocommerce' ) ) ?>",
data: order_data.order_coupon_counts,
color: '<?php echo $this->chart_colours['coupon_count' ]; ?>',
bars: { fillColor: '<?php echo $this->chart_colours['coupon_count' ]; ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo $this->barwidth; ?> * 0.5, align: 'center' },
color: '<?php echo $this->chart_colours['coupon_count']; ?>',
bars: { fillColor: '<?php echo $this->chart_colours['coupon_count']; ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo $this->barwidth; ?> * 0.5, align: 'center' },
shadowSize: 0,
hoverable: false
},

View File

@ -26,7 +26,7 @@ class WC_Report_Customer_List extends WP_List_Table {
parent::__construct( array(
'singular' => __( 'Customer', 'woocommerce' ),
'plural' => __( 'Customers', 'woocommerce' ),
'ajax' => false
'ajax' => false,
) );
}
@ -128,7 +128,7 @@ class WC_Report_Customer_List extends WP_List_Table {
$orders = wc_get_orders( array(
'limit' => 1,
'status' => array( 'wc-completed', 'wc-processing' ),
'customer' => $user->ID
'customer' => $user->ID,
) );
if ( ! empty( $orders ) ) {
@ -151,19 +151,19 @@ class WC_Report_Customer_List extends WP_List_Table {
$actions['refresh'] = array(
'url' => wp_nonce_url( add_query_arg( 'refresh', $user->ID ), 'refresh' ),
'name' => __( 'Refresh stats', 'woocommerce' ),
'action' => "refresh"
'action' => "refresh",
);
$actions['edit'] = array(
'url' => admin_url( 'user-edit.php?user_id=' . $user->ID ),
'name' => __( 'Edit', 'woocommerce' ),
'action' => "edit"
'action' => "edit",
);
$actions['view'] = array(
'url' => admin_url( 'edit.php?post_type=shop_order&_customer_user=' . $user->ID ),
'name' => __( 'View orders', 'woocommerce' ),
'action' => "view"
'action' => "view",
);
$orders = wc_get_orders( array(
@ -176,7 +176,7 @@ class WC_Report_Customer_List extends WP_List_Table {
$actions['link'] = array(
'url' => wp_nonce_url( add_query_arg( 'link_orders', $user->ID ), 'link_orders' ),
'name' => __( 'Link previous orders', 'woocommerce' ),
'action' => "link"
'action' => "link",
);
}
@ -212,7 +212,7 @@ class WC_Report_Customer_List extends WP_List_Table {
'orders' => __( 'Orders', 'woocommerce' ),
'spent' => __( 'Money Spent', 'woocommerce' ),
'last_order' => __( 'Last order', 'woocommerce' ),
'user_actions' => __( 'Actions', 'woocommerce' )
'user_actions' => __( 'Actions', 'woocommerce' ),
);
return $columns;
@ -263,21 +263,21 @@ class WC_Report_Customer_List extends WP_List_Table {
$admin_users = new WP_User_Query(
array(
'role' => 'administrator1',
'fields' => 'ID'
'fields' => 'ID',
)
);
$manager_users = new WP_User_Query(
array(
'role' => 'shop_manager',
'fields' => 'ID'
'fields' => 'ID',
)
);
$query = new WP_User_Query( array(
'exclude' => array_merge( $admin_users->get_results(), $manager_users->get_results() ),
'number' => $per_page,
'offset' => ( $current_page - 1 ) * $per_page
'offset' => ( $current_page - 1 ) * $per_page,
) );
$this->items = $query->get_results();
@ -290,7 +290,7 @@ class WC_Report_Customer_List extends WP_List_Table {
$this->set_pagination_args( array(
'total_items' => $query->total_users,
'per_page' => $per_page,
'total_pages' => ceil( $query->total_users / $per_page )
'total_pages' => ceil( $query->total_users / $per_page ),
) );
}
}

View File

@ -39,7 +39,7 @@ class WC_Report_Customers extends WC_Admin_Report {
$legend[] = array(
'title' => sprintf( __( '%s signups in this period', 'woocommerce' ), '<strong>' . sizeof( $this->customers ) . '</strong>' ),
'color' => $this->chart_colours['signups'],
'highlight_series' => 2
'highlight_series' => 2,
);
return $legend;
@ -55,7 +55,7 @@ class WC_Report_Customers extends WC_Admin_Report {
$widgets[] = array(
'title' => '',
'callback' => array( $this, 'customers_vs_guests' )
'callback' => array( $this, 'customers_vs_guests' ),
);
return $widgets;
@ -71,17 +71,17 @@ class WC_Report_Customers extends WC_Admin_Report {
'ID' => array(
'type' => 'post_data',
'function' => 'COUNT',
'name' => 'total_orders'
)
'name' => 'total_orders',
),
),
'where_meta' => array(
array(
'meta_key' => '_customer_user',
'meta_value' => '0',
'operator' => '>'
)
'operator' => '>',
),
),
'filter_range' => true
'filter_range' => true,
) );
$guest_order_totals = $this->get_order_report_data( array(
@ -89,17 +89,17 @@ class WC_Report_Customers extends WC_Admin_Report {
'ID' => array(
'type' => 'post_data',
'function' => 'COUNT',
'name' => 'total_orders'
)
'name' => 'total_orders',
),
),
'where_meta' => array(
array(
'meta_key' => '_customer_user',
'meta_value' => '0',
'operator' => '='
)
'operator' => '=',
),
),
'filter_range' => true
'filter_range' => true,
) );
?>
<div class="chart-container">
@ -162,13 +162,13 @@ class WC_Report_Customers extends WC_Admin_Report {
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
'month' => __( 'This Month', 'woocommerce' ),
'7day' => __( 'Last 7 Days', 'woocommerce' )
'7day' => __( 'Last 7 Days', 'woocommerce' ),
);
$this->chart_colours = array(
'signups' => '#3498db',
'customers' => '#1abc9c',
'guests' => '#8fdece'
'guests' => '#8fdece',
);
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
@ -182,21 +182,21 @@ class WC_Report_Customers extends WC_Admin_Report {
$admin_users = new WP_User_Query(
array(
'role' => 'administrator',
'fields' => 'ID'
'fields' => 'ID',
)
);
$manager_users = new WP_User_Query(
array(
'role' => 'shop_manager',
'fields' => 'ID'
'fields' => 'ID',
)
);
$users_query = new WP_User_Query(
array(
'fields' => array( 'user_registered' ),
'exclude' => array_merge( $admin_users->get_results(), $manager_users->get_results() )
'exclude' => array_merge( $admin_users->get_results(), $manager_users->get_results() ),
)
);
@ -242,25 +242,25 @@ class WC_Report_Customers extends WC_Admin_Report {
'ID' => array(
'type' => 'post_data',
'function' => 'COUNT',
'name' => 'total_orders'
'name' => 'total_orders',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where_meta' => array(
array(
'meta_key' => '_customer_user',
'meta_value' => '0',
'operator' => '>'
)
'operator' => '>',
),
),
'group_by' => $this->group_by_query,
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
$guest_orders = $this->get_order_report_data( array(
@ -268,25 +268,25 @@ class WC_Report_Customers extends WC_Admin_Report {
'ID' => array(
'type' => 'post_data',
'function' => 'COUNT',
'name' => 'total_orders'
'name' => 'total_orders',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where_meta' => array(
array(
'meta_key' => '_customer_user',
'meta_value' => '0',
'operator' => '='
)
'operator' => '=',
),
),
'group_by' => $this->group_by_query,
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
$signups = $this->prepare_chart_data( $this->customers, 'user_registered', '', $this->chart_interval, $this->start_date, $this->chart_groupby );
@ -297,7 +297,7 @@ class WC_Report_Customers extends WC_Admin_Report {
$chart_data = json_encode( array(
'signups' => array_values( $signups ),
'customer_orders' => array_values( $customer_orders ),
'guest_orders' => array_values( $guest_orders )
'guest_orders' => array_values( $guest_orders ),
) );
?>
<div class="chart-container">

View File

@ -94,8 +94,8 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
$legend[] = array(
'title' => sprintf( __( '%s sales in %s', 'woocommerce' ), '<strong>' . wc_price( $total ) . '</strong>', $category->name ),
'color' => isset( $this->chart_colours[ $index ] ) ? $this->chart_colours[ $index ] : $this->chart_colours[ 0 ],
'highlight_series' => $index
'color' => isset( $this->chart_colours[ $index ] ) ? $this->chart_colours[ $index ] : $this->chart_colours[0],
'highlight_series' => $index,
);
$index++;
@ -113,7 +113,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
'month' => __( 'This Month', 'woocommerce' ),
'7day' => __( 'Last 7 Days', 'woocommerce' )
'7day' => __( 'Last 7 Days', 'woocommerce' ),
);
$this->chart_colours = array( '#3498db', '#34495e', '#1abc9c', '#2ecc71', '#f1c40f', '#e67e22', '#e74c3c', '#2980b9', '#8e44ad', '#2c3e50', '#16a085', '#27ae60', '#f39c12', '#d35400', '#c0392b' );
@ -134,23 +134,23 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => '',
'name' => 'product_id'
'name' => 'product_id',
),
'_line_total' => array(
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_amount'
'name' => 'order_item_amount',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'group_by' => 'ID, product_id, post_date',
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
$this->item_sales = array();
@ -190,8 +190,8 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
return array(
array(
'title' => __( 'Categories', 'woocommerce' ),
'callback' => array( $this, 'category_widget' )
)
'callback' => array( $this, 'category_widget' ),
),
);
}

View File

@ -56,15 +56,15 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
)
'name' => 'post_date',
),
),
'group_by' => $this->group_by_query,
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true,
'order_types' => wc_get_order_types( 'order-count' ),
'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' )
'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' ),
) );
$this->report_data->coupons = (array) $this->get_order_report_data( array(
@ -72,33 +72,33 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'order_item_name' => array(
'type' => 'order_item',
'function' => '',
'name' => 'order_item_name'
'name' => 'order_item_name',
),
'discount_amount' => array(
'type' => 'order_item_meta',
'order_item_type' => 'coupon',
'function' => 'SUM',
'name' => 'discount_amount'
'name' => 'discount_amount',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where' => array(
array(
'key' => 'order_items.order_item_type',
'value' => 'coupon',
'operator' => '='
)
'operator' => '=',
),
),
'group_by' => $this->group_by_query . ', order_item_name',
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true,
'order_types' => wc_get_order_types( 'order-count' ),
'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' )
'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' ),
) );
// All items from orders - even those refunded
@ -108,20 +108,20 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_count'
'name' => 'order_item_count',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'where' => array(
array(
'key' => 'order_items.order_item_type',
'value' => 'line_item',
'operator' => '='
)
'operator' => '=',
),
),
'group_by' => $this->group_by_query,
'order_by' => 'post_date ASC',
@ -140,20 +140,20 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_count'
)
'name' => 'order_item_count',
),
),
'where' => array(
array(
'key' => 'order_items.order_item_type',
'value' => 'line_item',
'operator' => '='
)
'operator' => '=',
),
),
'query_type' => 'get_var',
'filter_range' => true,
'order_types' => wc_get_order_types( 'order-count' ),
'order_status' => array( 'refunded' )
'order_status' => array( 'refunded' ),
) ) );
/**
@ -164,27 +164,27 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'_order_total' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'total_sales'
'name' => 'total_sales',
),
'_order_shipping' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'total_shipping'
'name' => 'total_shipping',
),
'_order_tax' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'total_tax'
'name' => 'total_tax',
),
'_order_shipping_tax' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'total_shipping_tax'
'name' => 'total_shipping_tax',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
),
'group_by' => $this->group_by_query,
@ -192,7 +192,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'query_type' => 'get_results',
'filter_range' => true,
'order_types' => wc_get_order_types( 'sales-reports' ),
'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' )
'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' ),
) );
/**
@ -204,34 +204,34 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'_order_total' => array(
'type' => 'parent_meta',
'function' => '',
'name' => 'total_refund'
'name' => 'total_refund',
),
'_order_shipping' => array(
'type' => 'parent_meta',
'function' => '',
'name' => 'total_shipping'
'name' => 'total_shipping',
),
'_order_tax' => array(
'type' => 'parent_meta',
'function' => '',
'name' => 'total_tax'
'name' => 'total_tax',
),
'_order_shipping_tax' => array(
'type' => 'parent_meta',
'function' => '',
'name' => 'total_shipping_tax'
'name' => 'total_shipping_tax',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
)
'name' => 'post_date',
),
),
'group_by' => 'posts.post_parent',
'query_type' => 'get_results',
'filter_range' => true,
'order_status' => false,
'parent_order_status' => array( 'refunded' )
'parent_order_status' => array( 'refunded' ),
) );
/**
@ -242,53 +242,53 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'ID' => array(
'type' => 'post_data',
'function' => '',
'name' => 'refund_id'
'name' => 'refund_id',
),
'_refund_amount' => array(
'type' => 'meta',
'function' => '',
'name' => 'total_refund'
'name' => 'total_refund',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
'order_item_type' => array(
'type' => 'order_item',
'function' => '',
'name' => 'item_type',
'join_type' => 'LEFT'
'join_type' => 'LEFT',
),
'_order_total' => array(
'type' => 'meta',
'function' => '',
'name' => 'total_sales'
'name' => 'total_sales',
),
'_order_shipping' => array(
'type' => 'meta',
'function' => '',
'name' => 'total_shipping',
'join_type' => 'LEFT'
'join_type' => 'LEFT',
),
'_order_tax' => array(
'type' => 'meta',
'function' => '',
'name' => 'total_tax',
'join_type' => 'LEFT'
'join_type' => 'LEFT',
),
'_order_shipping_tax' => array(
'type' => 'meta',
'function' => '',
'name' => 'total_shipping_tax',
'join_type' => 'LEFT'
'join_type' => 'LEFT',
),
'_qty' => array(
'type' => 'order_item_meta',
'function' => 'SUM',
'name' => 'order_item_count',
'join_type' => 'LEFT'
)
'join_type' => 'LEFT',
),
),
'group_by' => 'refund_id',
'order_by' => 'post_date ASC',
@ -312,12 +312,12 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
$this->report_data->total_tax_refunded += ( $value->total_tax * -1 );
$this->report_data->total_refunds += $value->total_refund;
}
elseif( 'shipping' === $value->item_type ) {
elseif ( 'shipping' === $value->item_type ) {
$this->report_data->total_shipping_tax_refunded += ( $value->total_shipping_tax * -1 );
$this->report_data->total_shipping_refunded += wc_format_decimal( $value->total_refund, 2 );
$this->report_data->total_refunds += $value->total_refund;
}
elseif( 'line_item' === $value->item_type ) {
elseif ( 'line_item' === $value->item_type ) {
$this->report_data->total_tax_refunded += ( $value->total_tax * -1 );
$this->report_data->refunded_order_items += absint( $value->order_item_count );
$this->report_data->total_refunds += $value->total_refund;
@ -344,7 +344,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
// Item counts
$this->report_data->total_items = absint( array_sum( wp_list_pluck( $this->report_data->order_items, 'order_item_count' ) ) ) - $this->report_data->refunded_order_items;
// 3rd party filtering of report data
$this->report_data = apply_filters( 'woocommerce_admin_report_data', $this->report_data );
}
@ -373,13 +373,13 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'title' => sprintf( __( '%s gross sales in this period', 'woocommerce' ), '<strong>' . wc_price( $data->total_sales ) . '</strong>' ),
'placeholder' => __( 'This is the sum of the order totals after any refunds and including shipping and taxes.', 'woocommerce' ),
'color' => $this->chart_colours['sales_amount'],
'highlight_series' => 6
'highlight_series' => 6,
);
if ( $data->average_total_sales > 0 ) {
$legend[] = array(
'title' => $average_total_sales_title,
'color' => $this->chart_colours['average'],
'highlight_series' => 2
'highlight_series' => 2,
);
}
@ -387,41 +387,41 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'title' => sprintf( __( '%s net sales in this period', 'woocommerce' ), '<strong>' . wc_price( $data->net_sales ) . '</strong>' ),
'placeholder' => __( 'This is the sum of the order totals after any refunds and excluding shipping and taxes.', 'woocommerce' ),
'color' => $this->chart_colours['net_sales_amount'],
'highlight_series' => 7
'highlight_series' => 7,
);
if ( $data->average_sales > 0 ) {
$legend[] = array(
'title' => $average_sales_title,
'color' => $this->chart_colours['net_average'],
'highlight_series' => 3
'highlight_series' => 3,
);
}
$legend[] = array(
'title' => sprintf( __( '%s orders placed', 'woocommerce' ), '<strong>' . $data->total_orders . '</strong>' ),
'color' => $this->chart_colours['order_count'],
'highlight_series' => 1
'highlight_series' => 1,
);
$legend[] = array(
'title' => sprintf( __( '%s items purchased', 'woocommerce' ), '<strong>' . $data->total_items . '</strong>' ),
'color' => $this->chart_colours['item_count'],
'highlight_series' => 0
'highlight_series' => 0,
);
$legend[] = array(
'title' => sprintf( _nx( '%s refunded %d order', '%s refunded %d orders', $this->report_data->total_refunded_orders, '%s = amount of the refunds, %d = number of refunded orders.', 'woocommerce' ), '<strong>' . wc_price( $data->total_refunds ) . '</strong>', $this->report_data->total_refunded_orders ) . ' (' . sprintf( _n( '%d item', '%d items', $this->report_data->refunded_order_items, 'woocommerce' ), $this->report_data->refunded_order_items ) . ')',
'color' => $this->chart_colours['refund_amount'],
'highlight_series' => 8
'highlight_series' => 8,
);
$legend[] = array(
'title' => sprintf( __( '%s charged for shipping', 'woocommerce' ), '<strong>' . wc_price( $data->total_shipping ) . '</strong>' ),
'color' => $this->chart_colours['shipping_amount'],
'highlight_series' => 5
'highlight_series' => 5,
);
$legend[] = array(
'title' => sprintf( __( '%s worth of coupons used', 'woocommerce' ), '<strong>' . wc_price( $data->total_coupons ) . '</strong>' ),
'color' => $this->chart_colours['coupon_amount'],
'highlight_series' => 4
'highlight_series' => 4,
);
return $legend;
@ -435,7 +435,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
'month' => __( 'This Month', 'woocommerce' ),
'7day' => __( 'Last 7 Days', 'woocommerce' )
'7day' => __( 'Last 7 Days', 'woocommerce' ),
);
$this->chart_colours = array(
@ -447,7 +447,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'item_count' => '#ecf0f1',
'shipping_amount' => '#5cc488',
'coupon_amount' => '#f1c40f',
'refund_amount' => '#e74c3c'
'refund_amount' => '#e74c3c',
);
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
@ -513,7 +513,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'shipping_tax_amounts' => $this->prepare_chart_data( $this->report_data->orders, 'post_date', 'total_shipping_tax', $this->chart_interval, $this->start_date, $this->chart_groupby ),
'tax_amounts' => $this->prepare_chart_data( $this->report_data->orders, 'post_date', 'total_tax', $this->chart_interval, $this->start_date, $this->chart_groupby ),
'net_order_amounts' => array(),
'gross_order_amounts' => array()
'gross_order_amounts' => array(),
);
foreach ( $data['order_amounts'] as $order_amount_key => $order_amount_value ) {
@ -522,16 +522,16 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
$data['net_order_amounts'][ $order_amount_key ] = $order_amount_value;
// subtract the sum of the values from net order amounts
$data['net_order_amounts'][ $order_amount_key ][1] -=
$data['net_order_amounts'][ $order_amount_key ][1] -=
$data['refund_amounts'][ $order_amount_key ][1] +
$data['shipping_amounts'][ $order_amount_key ][1] +
$data['shipping_tax_amounts'][ $order_amount_key ][1] +
$data['shipping_amounts'][ $order_amount_key ][1] +
$data['shipping_tax_amounts'][ $order_amount_key ][1] +
$data['tax_amounts'][ $order_amount_key ][1];
}
// 3rd party filtering of report data
$data = apply_filters( 'woocommerce_admin_report_chart_data', $data );
// Encode in json format
$chart_data = json_encode( array(
'order_counts' => array_values( $data['order_counts'] ),
@ -541,7 +541,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'net_order_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $data['net_order_amounts'] ) ),
'shipping_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $data['shipping_amounts'] ) ),
'coupon_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $data['coupon_amounts'] ) ),
'refund_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $data['refund_amounts'] ) )
'refund_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $data['refund_amounts'] ) ),
) );
?>
<div class="chart-container">

View File

@ -64,8 +64,8 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_amount'
)
'name' => 'order_item_amount',
),
),
'where_meta' => array(
'relation' => 'OR',
@ -73,11 +73,11 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'meta_key' => array( '_product_id', '_variation_id' ),
'meta_value' => $this->product_ids,
'operator' => 'IN'
'operator' => 'IN',
)
),
'query_type' => 'get_var',
'filter_range' => true
'filter_range' => true,
) );
$total_items = absint( $this->get_order_report_data( array(
@ -86,8 +86,8 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_count'
)
'name' => 'order_item_count',
),
),
'where_meta' => array(
'relation' => 'OR',
@ -95,23 +95,23 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'meta_key' => array( '_product_id', '_variation_id' ),
'meta_value' => $this->product_ids,
'operator' => 'IN'
'operator' => 'IN',
)
),
'query_type' => 'get_var',
'filter_range' => true
'filter_range' => true,
) ) );
$legend[] = array(
'title' => sprintf( __( '%s sales for the selected items', 'woocommerce' ), '<strong>' . wc_price( $total_sales ) . '</strong>' ),
'color' => $this->chart_colours['sales_amount'],
'highlight_series' => 1
'highlight_series' => 1,
);
$legend[] = array(
'title' => sprintf( __( '%s purchases for the selected items', 'woocommerce' ), '<strong>' . ( $total_items ) . '</strong>' ),
'color' => $this->chart_colours['item_count'],
'highlight_series' => 0
'highlight_series' => 0,
);
return $legend;
@ -126,7 +126,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
'month' => __( 'This Month', 'woocommerce' ),
'7day' => __( 'Last 7 Days', 'woocommerce' )
'7day' => __( 'Last 7 Days', 'woocommerce' ),
);
$this->chart_colours = array(
@ -156,13 +156,13 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
if ( ! empty( $this->product_ids ) ) {
$widgets[] = array(
'title' => __( 'Showing reports for:', 'woocommerce' ),
'callback' => array( $this, 'current_filters' )
'callback' => array( $this, 'current_filters' ),
);
}
$widgets[] = array(
'title' => '',
'callback' => array( $this, 'products_widget' )
'callback' => array( $this, 'products_widget' ),
);
return $widgets;
@ -220,20 +220,20 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => '',
'name' => 'product_id'
'name' => 'product_id',
),
'_qty' => array(
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_qty'
)
'name' => 'order_item_qty',
),
),
'order_by' => 'order_item_qty DESC',
'group_by' => 'product_id',
'limit' => 12,
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
if ( $top_sellers ) {
@ -260,28 +260,28 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => '',
'name' => 'product_id'
'name' => 'product_id',
),
'_qty' => array(
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_qty'
)
'name' => 'order_item_qty',
),
),
'where_meta' => array(
array(
'type' => 'order_item_meta',
'meta_key' => '_line_subtotal',
'meta_value' => '0',
'operator' => '='
)
'operator' => '=',
),
),
'order_by' => 'order_item_qty DESC',
'group_by' => 'product_id',
'limit' => 12,
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
if ( $top_freebies ) {
@ -308,20 +308,20 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => '',
'name' => 'product_id'
'name' => 'product_id',
),
'_line_total' => array(
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_total'
)
'name' => 'order_item_total',
),
),
'order_by' => 'order_item_total DESC',
'group_by' => 'product_id',
'limit' => 12,
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
if ( $top_earners ) {
@ -402,19 +402,19 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_count'
'name' => 'order_item_count',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
'_product_id' => array(
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => '',
'name' => 'product_id'
)
'name' => 'product_id',
),
),
'where_meta' => array(
'relation' => 'OR',
@ -422,13 +422,13 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'meta_key' => array( '_product_id', '_variation_id' ),
'meta_value' => $this->product_ids,
'operator' => 'IN'
'operator' => 'IN',
),
),
'group_by' => 'product_id,' . $this->group_by_query,
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
$order_item_amounts = $this->get_order_report_data( array(
@ -437,18 +437,18 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => 'SUM',
'name' => 'order_item_amount'
'name' => 'order_item_amount',
),
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
'_product_id' => array(
'type' => 'order_item_meta',
'order_item_type' => 'line_item',
'function' => '',
'name' => 'product_id'
'name' => 'product_id',
),
),
'where_meta' => array(
@ -457,13 +457,13 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'type' => 'order_item_meta',
'meta_key' => array( '_product_id', '_variation_id' ),
'meta_value' => $this->product_ids,
'operator' => 'IN'
'operator' => 'IN',
),
),
'group_by' => 'product_id, ' . $this->group_by_query,
'order_by' => 'post_date ASC',
'query_type' => 'get_results',
'filter_range' => true
'filter_range' => true,
) );
// Prepare data for report
@ -473,7 +473,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
// Encode in json format
$chart_data = json_encode( array(
'order_item_counts' => array_values( $order_item_counts ),
'order_item_amounts' => array_values( $order_item_amounts )
'order_item_amounts' => array_values( $order_item_amounts ),
) );
?>
<div class="chart-container">

View File

@ -33,7 +33,7 @@ class WC_Report_Stock extends WP_List_Table {
parent::__construct( array(
'singular' => __( 'Stock', 'woocommerce' ),
'plural' => __( 'Stock', 'woocommerce' ),
'ajax' => false
'ajax' => false,
) );
}
@ -80,7 +80,7 @@ class WC_Report_Stock extends WP_List_Table {
$product = wc_get_product( $item->id );
}
switch( $column_name ) {
switch ( $column_name ) {
case 'product' :
if ( $sku = $product->get_sku() ) {
@ -132,14 +132,14 @@ class WC_Report_Stock extends WP_List_Table {
$actions['edit'] = array(
'url' => admin_url( 'post.php?post=' . $action_id . '&action=edit' ),
'name' => __( 'Edit', 'woocommerce' ),
'action' => "edit"
'action' => "edit",
);
if ( $product->is_visible() ) {
$actions['view'] = array(
'url' => get_permalink( $action_id ),
'name' => __( 'View', 'woocommerce' ),
'action' => "view"
'action' => "view",
);
}
@ -189,7 +189,7 @@ class WC_Report_Stock extends WP_List_Table {
$this->set_pagination_args( array(
'total_items' => $this->max_items,
'per_page' => $per_page,
'total_pages' => ceil( $this->max_items / $per_page )
'total_pages' => ceil( $this->max_items / $per_page ),
) );
}
}

View File

@ -76,30 +76,30 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
'order_item_name' => array(
'type' => 'order_item',
'function' => '',
'name' => 'tax_rate'
'name' => 'tax_rate',
),
'tax_amount' => array(
'type' => 'order_item_meta',
'order_item_type' => 'tax',
'function' => '',
'name' => 'tax_amount'
'name' => 'tax_amount',
),
'shipping_tax_amount' => array(
'type' => 'order_item_meta',
'order_item_type' => 'tax',
'function' => '',
'name' => 'shipping_tax_amount'
'name' => 'shipping_tax_amount',
),
'rate_id' => array(
'type' => 'order_item_meta',
'order_item_type' => 'tax',
'function' => '',
'name' => 'rate_id'
'name' => 'rate_id',
),
'ID' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_id'
'name' => 'post_id',
),
);
@ -107,13 +107,13 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
array(
'key' => 'order_item_type',
'value' => 'tax',
'operator' => '='
'operator' => '=',
),
array(
'key' => 'order_item_name',
'value' => '',
'operator' => '!='
)
'operator' => '!=',
),
);
$tax_rows_orders = $this->get_order_report_data( array(
@ -124,7 +124,7 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
'filter_range' => true,
'order_types' => array_merge( wc_get_order_types( 'sales-reports' ), array( 'shop_order_refund' ) ),
'order_status' => array( 'completed', 'processing', 'on-hold' ),
'parent_order_status' => array( 'completed', 'processing', 'on-hold' ) // Partial refunds inside refunded orders should be ignored
'parent_order_status' => array( 'completed', 'processing', 'on-hold' ), // Partial refunds inside refunded orders should be ignored
) );
// Merge

View File

@ -74,22 +74,22 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
'_order_tax' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'tax_amount'
'name' => 'tax_amount',
),
'_order_shipping_tax' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'shipping_tax_amount'
'name' => 'shipping_tax_amount',
),
'_order_total' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'total_sales'
'name' => 'total_sales',
),
'_order_shipping' => array(
'type' => 'meta',
'function' => 'SUM',
'name' => 'total_shipping'
'name' => 'total_shipping',
),
'ID' => array(
'type' => 'post_data',
@ -100,7 +100,7 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
'post_date' => array(
'type' => 'post_data',
'function' => '',
'name' => 'post_date'
'name' => 'post_date',
),
);
@ -111,7 +111,7 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
'query_type' => 'get_results',
'filter_range' => true,
'order_types' => wc_get_order_types( 'sales-reports' ),
'order_status' => array( 'completed', 'processing', 'on-hold' )
'order_status' => array( 'completed', 'processing', 'on-hold' ),
) );
$tax_rows_partial_refunds = $this->get_order_report_data( array(
@ -121,7 +121,7 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
'query_type' => 'get_results',
'filter_range' => true,
'order_types' => array( 'shop_order_refund' ),
'parent_order_status' => array( 'completed', 'processing', 'on-hold' ) // Partial refunds inside refunded orders should be ignored
'parent_order_status' => array( 'completed', 'processing', 'on-hold' ),// Partial refunds inside refunded orders should be ignored
) );
// Merge

View File

@ -55,7 +55,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array( 'type' => 'sectionend', 'id' => 'account_page_options' ),
array( 'title' => '', 'type' => 'title', 'id' => 'account_registration_options' ),
array( 'title' => '', 'type' => 'title', 'id' => 'account_registration_options' ),
array(
'title' => __( 'Enable Registration', 'woocommerce' ),
@ -64,7 +64,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false
'autoload' => false,
),
array(
@ -73,7 +73,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'autoload' => false
'autoload' => false,
),
array(
@ -83,7 +83,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false
'autoload' => false,
),
array(
@ -93,7 +93,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false
'autoload' => false,
),
array(
@ -102,7 +102,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'autoload' => false
'autoload' => false,
),
array( 'type' => 'sectionend', 'id' => 'account_registration_options' ),

View File

@ -44,7 +44,7 @@ class WC_Settings_Rest_API extends WC_Settings_Page {
$sections = array(
'' => __( 'Settings', 'woocommerce' ),
'keys' => __( 'Keys/Apps', 'woocommerce' ),
'webhooks' => __( 'Webhooks', 'woocommerce' )
'webhooks' => __( 'Webhooks', 'woocommerce' ),
);
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
@ -61,7 +61,7 @@ class WC_Settings_Rest_API extends WC_Settings_Page {
'title' => __( 'General Options', 'woocommerce' ),
'type' => 'title',
'desc' => '',
'id' => 'general_options'
'id' => 'general_options',
),
array(
@ -74,7 +74,7 @@ class WC_Settings_Rest_API extends WC_Settings_Page {
array(
'type' => 'sectionend',
'id' => 'general_options'
'id' => 'general_options',
),
) );

View File

@ -41,7 +41,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
*/
public function get_sections() {
$sections = array(
'' => __( 'Checkout Options', 'woocommerce' )
'' => __( 'Checkout Options', 'woocommerce' ),
);
if ( ! defined( 'WC_INSTALLING' ) ) {
@ -78,7 +78,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
),
array(
@ -86,7 +86,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'id' => 'woocommerce_calc_discounts_sequentially',
'default' => 'no',
'type' => 'checkbox',
'desc_tip' => __( 'When applying multiple coupons, apply the first coupon to the full price and the second coupon to the discounted price and so on.', 'woocommerce' ),
'desc_tip' => __( 'When applying multiple coupons, apply the first coupon to the full price and the second coupon to the discounted price and so on.', 'woocommerce' ),
'checkboxgroup' => 'end',
'autoload' => false,
),
@ -94,7 +94,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
array(
'title' => _x( 'Checkout Process', 'Settings group label', 'woocommerce' ),
'desc' => __( 'Enable guest checkout', 'woocommerce' ),
'desc_tip' => __( 'Allows customers to checkout without creating an account.', 'woocommerce' ),
'desc_tip' => __( 'Allows customers to checkout without creating an account.', 'woocommerce' ),
'id' => 'woocommerce_enable_guest_checkout',
'default' => 'yes',
'type' => 'checkbox',
@ -219,7 +219,6 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'desc_tip' => true,
),
array(
'type' => 'sectionend',
'id' => 'checkout_endpoint_options',
@ -289,7 +288,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'sort' => '',
'name' => __( 'Gateway', 'woocommerce' ),
'id' => __( 'Gateway ID', 'woocommerce' ),
'status' => __( 'Enabled', 'woocommerce' )
'status' => __( 'Enabled', 'woocommerce' ),
) );
foreach ( $columns as $key => $column ) {

View File

@ -40,7 +40,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
*/
public function get_sections() {
$sections = array(
'' => __( 'Email Options', 'woocommerce' )
'' => __( 'Email Options', 'woocommerce' ),
);
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
}
@ -71,7 +71,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'css' => 'min-width:300px;',
'default' => esc_attr( get_bloginfo( 'name', 'display' ) ),
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array(
@ -80,12 +80,12 @@ class WC_Settings_Emails extends WC_Settings_Page {
'id' => 'woocommerce_email_from_address',
'type' => 'email',
'custom_attributes' => array(
'multiple' => 'multiple'
'multiple' => 'multiple',
),
'css' => 'min-width:300px;',
'default' => get_option( 'admin_email' ),
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array( 'type' => 'sectionend', 'id' => 'email_options' ),
@ -101,7 +101,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'placeholder' => __( 'N/A', 'woocommerce' ),
'default' => '',
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array(
@ -113,7 +113,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'type' => 'textarea',
'default' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by WooCommerce', 'woocommerce' ),
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array(
@ -124,7 +124,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'css' => 'width:6em;',
'default' => '#96588a',
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array(
@ -135,7 +135,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'css' => 'width:6em;',
'default' => '#f7f7f7',
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array(
@ -146,7 +146,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'css' => 'width:6em;',
'default' => '#ffffff',
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array(
@ -157,7 +157,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'css' => 'width:6em;',
'default' => '#3c3c3c',
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array( 'type' => 'sectionend', 'id' => 'email_notification_settings' ),
@ -233,7 +233,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'name' => __( 'Email', 'woocommerce' ),
'email_type' => __( 'Content Type', 'woocommerce' ),
'recipient' => __( 'Recipient(s)', 'woocommerce' ),
'actions' => ''
'actions' => '',
) );
foreach ( $columns as $key => $column ) {
echo '<th class="wc-email-settings-table-' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';

View File

@ -56,7 +56,7 @@ class WC_Settings_General extends WC_Settings_Page {
'css' => 'min-width:350px;',
'default' => 'GB',
'type' => 'single_select_country',
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -67,12 +67,12 @@ class WC_Settings_General extends WC_Settings_Page {
'type' => 'select',
'class' => 'wc-enhanced-select',
'css' => 'min-width: 350px;',
'desc_tip' => true,
'desc_tip' => true,
'options' => array(
'all' => __( 'Sell to All Countries', 'woocommerce' ),
'all_except' => __( 'Sell to All Countries, Except For&hellip;', 'woocommerce' ),
'specific' => __( 'Sell to Specific Countries', 'woocommerce' )
)
'specific' => __( 'Sell to Specific Countries', 'woocommerce' ),
),
),
array(
@ -81,7 +81,7 @@ class WC_Settings_General extends WC_Settings_Page {
'id' => 'woocommerce_all_except_countries',
'css' => 'min-width: 350px;',
'default' => '',
'type' => 'multi_select_countries'
'type' => 'multi_select_countries',
),
array(
@ -90,7 +90,7 @@ class WC_Settings_General extends WC_Settings_Page {
'id' => 'woocommerce_specific_allowed_countries',
'css' => 'min-width: 350px;',
'default' => '',
'type' => 'multi_select_countries'
'type' => 'multi_select_countries',
),
array(
@ -106,7 +106,7 @@ class WC_Settings_General extends WC_Settings_Page {
'all' => __( 'Ship to all countries', 'woocommerce' ),
'specific' => __( 'Ship to specific countries only', 'woocommerce' ),
'disabled' => __( 'Disable shipping &amp; shipping calculations', 'woocommerce' ),
)
),
),
array(
@ -115,13 +115,13 @@ class WC_Settings_General extends WC_Settings_Page {
'id' => 'woocommerce_specific_ship_to_countries',
'css' => '',
'default' => '',
'type' => 'multi_select_countries'
'type' => 'multi_select_countries',
),
array(
'title' => __( 'Default Customer Location', 'woocommerce' ),
'id' => 'woocommerce_default_customer_address',
'desc_tip' => __( 'This option determines a customers default location. The MaxMind GeoLite Database will be periodically downloaded to your wp-content directory if using geolocation.', 'woocommerce' ),
'desc_tip' => __( 'This option determines a customers default location. The MaxMind GeoLite Database will be periodically downloaded to your wp-content directory if using geolocation.', 'woocommerce' ),
'default' => 'geolocation',
'type' => 'select',
'class' => 'wc-enhanced-select',
@ -138,7 +138,7 @@ class WC_Settings_General extends WC_Settings_Page {
'desc' => __( 'Enable taxes and tax calculations', 'woocommerce' ),
'id' => 'woocommerce_calc_taxes',
'default' => 'no',
'type' => 'checkbox'
'type' => 'checkbox',
),
array(
@ -146,7 +146,7 @@ class WC_Settings_General extends WC_Settings_Page {
'desc' => __( 'Enable site-wide store notice text', 'woocommerce' ),
'id' => 'woocommerce_demo_store',
'default' => 'no',
'type' => 'checkbox'
'type' => 'checkbox',
),
array(
@ -156,10 +156,10 @@ class WC_Settings_General extends WC_Settings_Page {
'default' => __( 'This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce' ),
'type' => 'textarea',
'css' => 'width:350px; height: 65px;',
'autoload' => false
'autoload' => false,
),
array( 'type' => 'sectionend', 'id' => 'general_options'),
array( 'type' => 'sectionend', 'id' => 'general_options' ),
array( 'title' => __( 'Currency Options', 'woocommerce' ), 'type' => 'title', 'desc' => __( 'The following options affect how prices are displayed on the frontend.', 'woocommerce' ), 'id' => 'pricing_options' ),
@ -171,8 +171,8 @@ class WC_Settings_General extends WC_Settings_Page {
'default' => 'GBP',
'type' => 'select',
'class' => 'wc-enhanced-select',
'desc_tip' => true,
'options' => $currency_code_options
'desc_tip' => true,
'options' => $currency_code_options,
),
array(
@ -187,9 +187,9 @@ class WC_Settings_General extends WC_Settings_Page {
'left' => __( 'Left', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . '99.99)',
'right' => __( 'Right', 'woocommerce' ) . ' (99.99' . get_woocommerce_currency_symbol() . ')',
'left_space' => __( 'Left with space', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ' 99.99)',
'right_space' => __( 'Right with space', 'woocommerce' ) . ' (99.99 ' . get_woocommerce_currency_symbol() . ')'
'right_space' => __( 'Right with space', 'woocommerce' ) . ' (99.99 ' . get_woocommerce_currency_symbol() . ')',
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -199,7 +199,7 @@ class WC_Settings_General extends WC_Settings_Page {
'css' => 'width:50px;',
'default' => ',',
'type' => 'text',
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -209,7 +209,7 @@ class WC_Settings_General extends WC_Settings_Page {
'css' => 'width:50px;',
'default' => '.',
'type' => 'text',
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -218,15 +218,15 @@ class WC_Settings_General extends WC_Settings_Page {
'id' => 'woocommerce_price_num_decimals',
'css' => 'width:50px;',
'default' => '2',
'desc_tip' => true,
'desc_tip' => true,
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
)
'step' => 1,
),
),
array( 'type' => 'sectionend', 'id' => 'pricing_options' )
array( 'type' => 'sectionend', 'id' => 'pricing_options' ),
) );
@ -255,7 +255,6 @@ class WC_Settings_General extends WC_Settings_Page {
WC_Admin_Settings::save_fields( $settings );
}
}
endif;

View File

@ -85,7 +85,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'title' => __( 'Shop & Product Pages', 'woocommerce' ),
'type' => 'title',
'desc' => '',
'id' => 'catalog_options'
'id' => 'catalog_options',
),
array(
@ -112,7 +112,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'subcategories' => __( 'Show categories', 'woocommerce' ),
'both' => __( 'Show categories &amp; products', 'woocommerce' ),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -128,7 +128,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'subcategories' => __( 'Show subcategories', 'woocommerce' ),
'both' => __( 'Show subcategories &amp; products', 'woocommerce' ),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -147,7 +147,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'price' => __( 'Sort by price (asc)', 'woocommerce' ),
'price-desc' => __( 'Sort by price (desc)', 'woocommerce' ),
) ),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -156,7 +156,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'id' => 'woocommerce_cart_redirect_after_add',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start'
'checkboxgroup' => 'start',
),
array(
@ -164,19 +164,19 @@ class WC_Settings_Products extends WC_Settings_Page {
'id' => 'woocommerce_enable_ajax_add_to_cart',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
'checkboxgroup' => 'end',
),
array(
'type' => 'sectionend',
'id' => 'catalog_options'
'id' => 'catalog_options',
),
array(
'title' => __( 'Product Images', 'woocommerce' ),
'type' => 'title',
'desc' => sprintf( __( 'These settings affect the display and dimensions of images in your catalog - the display on the front-end will still be affected by CSS styles. After changing these settings you may need to <a target="_blank" href="%s">regenerate your thumbnails</a>.', 'woocommerce' ), 'https://wordpress.org/extend/plugins/regenerate-thumbnails/' ),
'id' => 'image_options'
'id' => 'image_options',
),
array(
@ -188,9 +188,9 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => array(
'width' => '300',
'height' => '300',
'crop' => 1
'crop' => 1,
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -202,9 +202,9 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => array(
'width' => '600',
'height' => '600',
'crop' => 1
'crop' => 1,
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -216,9 +216,9 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => array(
'width' => '180',
'height' => '180',
'crop' => 1
'crop' => 1,
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -227,13 +227,13 @@ class WC_Settings_Products extends WC_Settings_Page {
'id' => 'woocommerce_enable_lightbox',
'default' => 'yes',
'desc_tip' => __( 'Include WooCommerce\'s lightbox. Product gallery images will open in a lightbox.', 'woocommerce' ),
'type' => 'checkbox'
'type' => 'checkbox',
),
array(
'type' => 'sectionend',
'id' => 'image_options'
)
'id' => 'image_options',
),
));
} elseif ( 'inventory' == $current_section ) {
@ -244,7 +244,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'title' => __( 'Inventory', 'woocommerce' ),
'type' => 'title',
'desc' => '',
'id' => 'product_inventory_options'
'id' => 'product_inventory_options',
),
array(
@ -252,7 +252,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'desc' => __( 'Enable stock management', 'woocommerce' ),
'id' => 'woocommerce_manage_stock',
'default' => 'yes',
'type' => 'checkbox'
'type' => 'checkbox',
),
array(
@ -262,11 +262,11 @@ class WC_Settings_Products extends WC_Settings_Page {
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
'step' => 1,
),
'css' => 'width: 80px;',
'default' => '60',
'autoload' => false
'autoload' => false,
),
array(
@ -276,7 +276,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false
'autoload' => false,
),
array(
@ -285,7 +285,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'autoload' => false
'autoload' => false,
),
array(
@ -296,7 +296,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => get_option( 'admin_email' ),
'css' => 'width: 250px;',
'autoload' => false,
'desc_tip' => true
'desc_tip' => true,
),
array(
@ -307,7 +307,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
'step' => 1,
),
'default' => '2',
'autoload' => false,
@ -322,7 +322,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
'step' => 1,
),
'default' => '0',
'desc_tip' => true,
@ -333,7 +333,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'desc' => __( 'Hide out of stock items from the catalog', 'woocommerce' ),
'id' => 'woocommerce_hide_out_of_stock_items',
'default' => 'no',
'type' => 'checkbox'
'type' => 'checkbox',
),
array(
@ -349,12 +349,12 @@ class WC_Settings_Products extends WC_Settings_Page {
'low_amount' => __( 'Only show stock when low e.g. "Only 2 left in stock" vs. "In Stock"', 'woocommerce' ),
'no_amount' => __( 'Never show stock amount', 'woocommerce' ),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
'type' => 'sectionend',
'id' => 'product_inventory_options'
'id' => 'product_inventory_options',
),
));
@ -364,7 +364,7 @@ class WC_Settings_Products extends WC_Settings_Page {
array(
'title' => __( 'Downloadable Products', 'woocommerce' ),
'type' => 'title',
'id' => 'digital_download_options'
'id' => 'digital_download_options',
),
array(
@ -375,13 +375,13 @@ class WC_Settings_Products extends WC_Settings_Page {
'class' => 'wc-enhanced-select',
'css' => 'min-width:300px;',
'default' => 'force',
'desc_tip' => true,
'desc_tip' => true,
'options' => array(
'force' => __( 'Force Downloads', 'woocommerce' ),
'xsendfile' => __( 'X-Accel-Redirect/X-Sendfile', 'woocommerce' ),
'redirect' => __( 'Redirect only', 'woocommerce' ),
),
'autoload' => false
'autoload' => false,
),
array(
@ -392,7 +392,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => 'no',
'desc_tip' => __( 'This setting does not apply to guest purchases.', 'woocommerce' ),
'checkboxgroup' => 'start',
'autoload' => false
'autoload' => false,
),
array(
@ -402,12 +402,12 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => 'yes',
'desc_tip' => __( 'Enable this option to grant access to downloads when orders are "processing", rather than "completed".', 'woocommerce' ),
'checkboxgroup' => 'end',
'autoload' => false
'autoload' => false,
),
array(
'type' => 'sectionend',
'id' => 'digital_download_options'
'id' => 'digital_download_options',
),
));
@ -417,7 +417,7 @@ class WC_Settings_Products extends WC_Settings_Page {
array(
'title' => __( 'Measurements', 'woocommerce' ),
'type' => 'title',
'id' => 'product_measurement_options'
'id' => 'product_measurement_options',
),
array(
@ -434,7 +434,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'lbs' => __( 'lbs', 'woocommerce' ),
'oz' => __( 'oz', 'woocommerce' ),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -452,7 +452,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'in' => __( 'in', 'woocommerce' ),
'yd' => __( 'yd', 'woocommerce' ),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -509,7 +509,7 @@ class WC_Settings_Products extends WC_Settings_Page {
array(
'type' => 'sectionend',
'id' => 'product_rating_options'
'id' => 'product_rating_options',
),
));

View File

@ -47,7 +47,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
$sections = array(
'' => __( 'Shipping Zones', 'woocommerce' ),
'options' => __( 'Shipping Options', 'woocommerce' ),
'classes' => __( 'Shipping Classes', 'woocommerce' )
'classes' => __( 'Shipping Classes', 'woocommerce' ),
);
if ( ! defined( 'WC_INSTALLING' ) ) {
@ -83,7 +83,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false
'autoload' => false,
),
array(
@ -92,7 +92,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'autoload' => false
'autoload' => false,
),
array(
@ -107,7 +107,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
'billing_only' => __( 'Force shipping to the customer billing address', 'woocommerce' ),
),
'autoload' => false,
'desc_tip' => true,
'desc_tip' => true,
'show_if_checked' => 'option',
),
@ -118,7 +118,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
'id' => 'woocommerce_shipping_debug_mode',
'default' => 'no',
'type' => 'checkbox',
'autoload' => false
'autoload' => false,
),
array( 'type' => 'sectionend', 'id' => 'shipping_options' ),
@ -305,7 +305,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
'wc_shipping_classes_nonce' => wp_create_nonce( 'wc_shipping_classes_nonce' ),
'strings' => array(
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' )
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' ),
),
) );
wp_enqueue_script( 'wc-shipping-classes' );

View File

@ -53,7 +53,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
public function get_sections() {
$sections = array(
'' => __( 'Tax Options', 'woocommerce' ),
'standard' => __( 'Standard Rates', 'woocommerce' )
'standard' => __( 'Standard Rates', 'woocommerce' ),
);
// Get tax classes and display as links
@ -202,7 +202,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
$tax_classes = WC_Tax::get_tax_classes();
$current_class = '';
foreach( $tax_classes as $class ) {
foreach ( $tax_classes as $class ) {
if ( sanitize_title( $class ) == $current_section ) {
$current_class = $class;
}
@ -225,7 +225,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
'tax_rate_state',
'tax_rate',
'tax_rate_name',
'tax_rate_priority'
'tax_rate_priority',
);
foreach ( $tax_rate_keys as $tax_rate_key ) {

View File

@ -61,7 +61,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'product.updated' => __( 'Product Updated', 'woocommerce' ),
'product.deleted' => __( 'Product Deleted', 'woocommerce' ),
'action' => __( 'Action', 'woocommerce' ),
'custom' => __( 'Custom', 'woocommerce' )
'custom' => __( 'Custom', 'woocommerce' ),
) );
foreach ( $topics as $topic_slug => $topic_name ) : ?>

View File

@ -13,24 +13,24 @@ return apply_filters( 'woocommerce_tax_settings', array(
'id' => 'woocommerce_prices_include_tax',
'default' => 'no',
'type' => 'radio',
'desc_tip' => __( 'This option is important as it will affect how you input prices. Changing it will not update existing products.', 'woocommerce' ),
'desc_tip' => __( 'This option is important as it will affect how you input prices. Changing it will not update existing products.', 'woocommerce' ),
'options' => array(
'yes' => __( 'Yes, I will enter prices inclusive of tax', 'woocommerce' ),
'no' => __( 'No, I will enter prices exclusive of tax', 'woocommerce' )
'no' => __( 'No, I will enter prices exclusive of tax', 'woocommerce' ),
),
),
array(
'title' => __( 'Calculate Tax Based On', 'woocommerce' ),
'id' => 'woocommerce_tax_based_on',
'desc_tip' => __( 'This option determines which address is used to calculate tax.', 'woocommerce' ),
'desc_tip' => __( 'This option determines which address is used to calculate tax.', 'woocommerce' ),
'default' => 'shipping',
'type' => 'select',
'class' => 'wc-enhanced-select',
'options' => array(
'shipping' => __( 'Customer shipping address', 'woocommerce' ),
'billing' => __( 'Customer billing address', 'woocommerce' ),
'base' => __( 'Shop base address', 'woocommerce' )
'base' => __( 'Shop base address', 'woocommerce' ),
),
),
@ -43,7 +43,7 @@ return apply_filters( 'woocommerce_tax_settings', array(
'type' => 'select',
'class' => 'wc-enhanced-select',
'options' => array( '' => __( 'Shipping tax class based on cart items', 'woocommerce' ), 'standard' => __( 'Standard', 'woocommerce' ) ) + $classes_options,
'desc_tip' => true,
'desc_tip' => true,
),
array(
@ -60,7 +60,7 @@ return apply_filters( 'woocommerce_tax_settings', array(
'id' => 'woocommerce_tax_classes',
'css' => 'width:100%; height: 65px;',
'type' => 'textarea',
'default' => sprintf( __( 'Reduced Rate%sZero Rate', 'woocommerce' ), PHP_EOL )
'default' => sprintf( __( 'Reduced Rate%sZero Rate', 'woocommerce' ), PHP_EOL ),
),
array(
@ -72,7 +72,7 @@ return apply_filters( 'woocommerce_tax_settings', array(
'options' => array(
'incl' => __( 'Including tax', 'woocommerce' ),
'excl' => __( 'Excluding tax', 'woocommerce' ),
)
),
),
array(
@ -85,7 +85,7 @@ return apply_filters( 'woocommerce_tax_settings', array(
'incl' => __( 'Including tax', 'woocommerce' ),
'excl' => __( 'Excluding tax', 'woocommerce' ),
),
'autoload' => false
'autoload' => false,
),
array(
@ -107,7 +107,7 @@ return apply_filters( 'woocommerce_tax_settings', array(
'single' => __( 'As a single total', 'woocommerce' ),
'itemized' => __( 'Itemized', 'woocommerce' ),
),
'autoload' => false
'autoload' => false,
),
array( 'type' => 'sectionend', 'id' => 'tax_options' ),

View File

@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( $current_tab == $key ) {
echo 'nav-tab-active';
}
echo '">' . esc_html( $report_group[ 'title' ] ) . '</a>';
echo '">' . esc_html( $report_group['title'] ) . '</a>';
}
do_action( 'wc_reports_tabs' );
@ -51,9 +51,9 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
}
if ( isset( $reports[ $current_tab ][ 'reports' ][ $current_report ] ) ) {
if ( isset( $reports[ $current_tab ]['reports'][ $current_report ] ) ) {
$report = $reports[ $current_tab ][ 'reports' ][ $current_report ];
$report = $reports[ $current_tab ]['reports'][ $current_report ];
if ( ! isset( $report['hide_title'] ) || $report['hide_title'] != true ) {
echo '<h1>' . esc_html( $report['title'] ) . '</h1>';

View File

@ -506,7 +506,7 @@ $pages = $system_status->get_pages();
?></td>
</tr>
<?php
if( $theme['is_child_theme'] ) :
if ( $theme['is_child_theme'] ) :
?>
<tr>
<td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'woocommerce' ); ?>:</td>

View File

@ -26,9 +26,9 @@ if ( ! defined( 'ABSPATH' ) ) {
'' => __( '— No Change —', 'woocommerce' ),
'1' => __( 'Change to:', 'woocommerce' ),
'2' => __( 'Increase by (fixed amount or %):', 'woocommerce' ),
'3' => __( 'Decrease by (fixed amount or %):', 'woocommerce' )
'3' => __( 'Decrease by (fixed amount or %):', 'woocommerce' ),
);
foreach ($options as $key => $value) {
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
}
?>
@ -51,7 +51,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'1' => __( 'Change to:', 'woocommerce' ),
'2' => __( 'Increase by (fixed amount or %):', 'woocommerce' ),
'3' => __( 'Decrease by (fixed amount or %):', 'woocommerce' ),
'4' => __( 'Decrease regular price by (fixed amount or %):', 'woocommerce' )
'4' => __( 'Decrease regular price by (fixed amount or %):', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
@ -75,9 +75,9 @@ if ( ! defined( 'ABSPATH' ) ) {
'' => __( '— No Change —', 'woocommerce' ),
'taxable' => __( 'Taxable', 'woocommerce' ),
'shipping' => __( 'Shipping only', 'woocommerce' ),
'none' => _x( 'None', 'Tax status', 'woocommerce' )
'none' => _x( 'None', 'Tax status', 'woocommerce' ),
);
foreach ($options as $key => $value) {
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
}
?>
@ -92,7 +92,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'standard' => __( 'Standard', 'woocommerce' )
'standard' => __( 'Standard', 'woocommerce' ),
);
$tax_classes = WC_Tax::get_tax_classes();
@ -120,7 +120,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'1' => __( 'Change to:', 'woocommerce' )
'1' => __( 'Change to:', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -144,7 +144,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'1' => __( 'Change to:', 'woocommerce' )
'1' => __( 'Change to:', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -186,7 +186,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'visible' => __( 'Catalog &amp; search', 'woocommerce' ),
'catalog' => __( 'Catalog', 'woocommerce' ),
'search' => __( 'Search', 'woocommerce' ),
'hidden' => __( 'Hidden', 'woocommerce' )
'hidden' => __( 'Hidden', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -203,9 +203,9 @@ if ( ! defined( 'ABSPATH' ) ) {
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'yes' => __( 'Yes', 'woocommerce' ),
'no' => __( 'No', 'woocommerce' )
'no' => __( 'No', 'woocommerce' ),
);
foreach ($options as $key => $value) {
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
}
?>
@ -221,7 +221,7 @@ if ( ! defined( 'ABSPATH' ) ) {
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'instock' => __( 'In stock', 'woocommerce' ),
'outofstock' => __( 'Out of stock', 'woocommerce' )
'outofstock' => __( 'Out of stock', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -240,7 +240,7 @@ if ( ! defined( 'ABSPATH' ) ) {
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'yes' => __( 'Yes', 'woocommerce' ),
'no' => __( 'No', 'woocommerce' )
'no' => __( 'No', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -258,7 +258,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'1' => __( 'Change to:', 'woocommerce' )
'1' => __( 'Change to:', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -281,7 +281,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'' => __( '— No Change —', 'woocommerce' ),
'no' => __( 'Do not allow', 'woocommerce' ),
'notify' => __( 'Allow, but notify customer', 'woocommerce' ),
'yes' => __( 'Allow', 'woocommerce' )
'yes' => __( 'Allow', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -301,7 +301,7 @@ if ( ! defined( 'ABSPATH' ) ) {
$options = array(
'' => __( '— No Change —', 'woocommerce' ),
'yes' => __( 'Yes', 'woocommerce' ),
'no' => __( 'No', 'woocommerce' )
'no' => __( 'No', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>';

View File

@ -54,7 +54,7 @@ if ( ! defined( 'ABSPATH' ) ) {
$options = array(
'taxable' => __( 'Taxable', 'woocommerce' ),
'shipping' => __( 'Shipping only', 'woocommerce' ),
'none' => _x( 'None', 'Tax status', 'woocommerce' )
'none' => _x( 'None', 'Tax status', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
@ -70,7 +70,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<select class="tax_class" name="_tax_class">
<?php
$options = array(
'' => __( 'Standard', 'woocommerce' )
'' => __( 'Standard', 'woocommerce' ),
);
$tax_classes = WC_Tax::get_tax_classes();
@ -143,7 +143,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'visible' => __( 'Catalog &amp; search', 'woocommerce' ),
'catalog' => __( 'Catalog', 'woocommerce' ),
'search' => __( 'Search', 'woocommerce' ),
'hidden' => __( 'Hidden', 'woocommerce' )
'hidden' => __( 'Hidden', 'woocommerce' ),
) );
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';
@ -164,7 +164,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
$options = array(
'instock' => __( 'In stock', 'woocommerce' ),
'outofstock' => __( 'Out of stock', 'woocommerce' )
'outofstock' => __( 'Out of stock', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) .'">'. $value .'</option>';
@ -176,7 +176,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="stock_fields">
<?php if (get_option('woocommerce_manage_stock')=='yes') : ?>
<?php if ( get_option( 'woocommerce_manage_stock' ) == 'yes' ) : ?>
<label class="alignleft manage_stock">
<input type="checkbox" name="_manage_stock" value="1">
<span class="checkbox-title"><?php _e( 'Manage stock?', 'woocommerce' ); ?></span>
@ -200,7 +200,7 @@ if ( ! defined( 'ABSPATH' ) ) {
$options = array(
'no' => __( 'Do not allow', 'woocommerce' ),
'notify' => __( 'Allow, but notify customer', 'woocommerce' ),
'yes' => __( 'Allow', 'woocommerce' )
'yes' => __( 'Allow', 'woocommerce' ),
);
foreach ( $options as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">'. $value .'</option>';

View File

@ -36,7 +36,7 @@ function wc_get_screen_ids() {
'edit-product_cat',
'edit-product_tag',
'profile',
'user-edit'
'user-edit',
);
foreach ( wc_get_order_types() as $type ) {
@ -111,7 +111,7 @@ function wc_create_page( $slug, $option = '', $page_title = '', $page_content =
'post_title' => $page_title,
'post_content' => $page_content,
'post_parent' => $post_parent,
'comment_status' => 'closed'
'comment_status' => 'closed',
);
$page_id = wp_insert_post( $page_data );
}

View File

@ -56,7 +56,7 @@ function woocommerce_wp_text_input( $field ) {
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) {
foreach ( $field['custom_attributes'] as $attribute => $value ){
foreach ( $field['custom_attributes'] as $attribute => $value ) {
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
}
}
@ -109,7 +109,7 @@ function woocommerce_wp_textarea_input( $field ) {
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) {
foreach ( $field['custom_attributes'] as $attribute => $value ){
foreach ( $field['custom_attributes'] as $attribute => $value ) {
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
}
}
@ -148,7 +148,7 @@ function woocommerce_wp_checkbox( $field ) {
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) {
foreach ( $field['custom_attributes'] as $attribute => $value ){
foreach ( $field['custom_attributes'] as $attribute => $value ) {
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
}
}
@ -187,7 +187,7 @@ function woocommerce_wp_select( $field ) {
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) {
foreach ( $field['custom_attributes'] as $attribute => $value ){
foreach ( $field['custom_attributes'] as $attribute => $value ) {
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
}
}

View File

@ -154,7 +154,7 @@ class WC_REST_Authentication {
// From OAuth PHP library, used under MIT license.
$params = array();
if ( preg_match_all( '/(oauth_[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches ) ) {
foreach ( $matches[ 1 ] as $i => $h ) {
foreach ( $matches[1] as $i => $h ) {
$params[ $h ] = urldecode( empty( $matches[3][ $i ] ) ? $matches[4][ $i ] : $matches[3][ $i ] );
}
if ( isset( $params['realm'] ) ) {
@ -224,7 +224,7 @@ class WC_REST_Authentication {
'oauth_timestamp',
'oauth_nonce',
'oauth_signature',
'oauth_signature_method'
'oauth_signature_method',
);
$errors = array();

View File

@ -126,7 +126,6 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
if ( ! empty( $request['code'] ) ) {
$id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->posts WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish'", $request['code'] ) );
$args['post__in'] = array( $id );
}
@ -141,44 +140,32 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
* @return WP_REST_Response $data
*/
public function prepare_item_for_response( $post, $request ) {
// Get the coupon code.
$code = wc_get_coupon_code_by_id( $post->ID );
$code = wc_get_coupon_code_by_id( $post->ID );
$coupon = new WC_Coupon( $code );
$data = $coupon->get_data();
$format_decimal = array( 'amount', 'minimum_amount', 'maximum_amount' );
$format_date = array( 'date_created', 'date_modified', 'date_expires' );
$format_null = array( 'usage_limit', 'usage_limit_per_user', 'limit_usage_to_x_items' );
$coupon = new WC_Coupon( $code );
// Format decimal values.
foreach ( $format_decimal as $key ) {
$data[ $key ] = wc_format_decimal( $data[ $key ], 2 );
}
$data = array(
'id' => $coupon->get_id(),
'code' => $coupon->get_code(),
'date_created' => wc_rest_prepare_date_response( $post->post_date_gmt ),
'date_modified' => wc_rest_prepare_date_response( $post->post_modified_gmt ),
'discount_type' => $coupon->get_discount_type(),
'description' => $coupon->get_description(),
'amount' => wc_format_decimal( $coupon->get_amount(), 2 ),
'expiry_date' => $coupon->get_expiry_date() ? wc_rest_prepare_date_response( $coupon->get_expiry_date() ) : null,
'usage_count' => (int) $coupon->get_usage_count(),
'individual_use' => $coupon->get_individual_use(),
'product_ids' => array_map( 'absint', (array) $coupon->get_product_ids() ),
'exclude_product_ids' => array_map( 'absint', (array) $coupon->get_excluded_product_ids() ),
'usage_limit' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : null,
'usage_limit_per_user' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : null,
'limit_usage_to_x_items' => (int) $coupon->get_limit_usage_to_x_items(),
'free_shipping' => $coupon->get_free_shipping(),
'product_categories' => array_map( 'absint', (array) $coupon->get_product_categories() ),
'excluded_product_categories' => array_map( 'absint', (array) $coupon->get_excluded_product_categories() ),
'exclude_sale_items' => $coupon->get_exclude_sale_items(),
'minimum_amount' => wc_format_decimal( $coupon->get_minimum_amount(), 2 ),
'maximum_amount' => wc_format_decimal( $coupon->get_maximum_amount(), 2 ),
'email_restrictions' => $coupon->get_email_restrictions(),
'used_by' => $coupon->get_used_by(),
);
// Format date values.
foreach ( $format_date as $key ) {
$data[ $key ] = $data[ $key ] ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $data[ $key ] ) ) ) : null;
}
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );
// Format null values.
foreach ( $format_null as $key ) {
$data[ $key ] = $data[ $key ] ? $data[ $key ] : null;
}
// Wrap the data in a response object.
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );
$response = rest_ensure_response( $data );
$response->add_links( $this->prepare_links( $post ) );
/**
@ -194,6 +181,15 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
}
/**
* Only reutrn writeable props from schema.
* @param array $schema
* @return bool
*/
protected function filter_writable_props( $schema ) {
return empty( $schema['readonly'] );
}
/**
* Prepare a single coupon for create or update.
*
@ -203,15 +199,18 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
protected function prepare_item_for_database( $request ) {
global $wpdb;
// ID.
if ( isset( $request['id'] ) ) {
$code = wc_get_coupon_code_by_id( $request['id'] );
$coupon = new WC_Coupon( $code );
} else {
$coupon = new WC_Coupon();
}
$id = isset( $request['id'] ) ? absint( $request['id'] ) : 0;
$coupon = new WC_Coupon( $id );
$schema = $this->get_item_schema();
$data_keys = array_keys( array_filter( $schema['properties'], array( $this, 'filter_writable_props' ) ) );
$schema = $this->get_item_schema();
// BW compat
if ( $request['exclude_product_ids'] ) {
$request['excluded_product_ids'] = $request['exclude_product_ids'];
}
if ( $request['expiry_date'] ) {
$request['date_expires'] = $request['expiry_date'];
}
// Validate required POST fields.
if ( 'POST' === $request->get_method() && 0 === $coupon->get_id() ) {
@ -220,31 +219,40 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
}
}
// Code.
if ( ! empty( $schema['properties']['code'] ) && ! empty( $request['code'] ) ) {
$coupon_code = apply_filters( 'woocommerce_coupon_code', $request['code'] );
$id = $coupon->get_id() ? $coupon->get_id() : 0;
// Handle all writable props
foreach ( $data_keys as $key ) {
$value = $request[ $key ];
// Check for duplicate coupon codes.
$coupon_found = $wpdb->get_var( $wpdb->prepare( "
SELECT $wpdb->posts.ID
FROM $wpdb->posts
WHERE $wpdb->posts.post_type = 'shop_coupon'
AND $wpdb->posts.post_status = 'publish'
AND $wpdb->posts.post_title = '%s'
AND $wpdb->posts.ID != %s
", $coupon_code, $id ) );
if ( ! is_null( $value ) ) {
switch ( $key ) {
case 'code' :
$coupon_code = apply_filters( 'woocommerce_coupon_code', $value );
$id = $coupon->get_id() ? $coupon->get_id() : 0;
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id );
if ( $coupon_found ) {
return new WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce' ), array( 'status' => 400 ) );
if ( $id_from_code ) {
return new WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce' ), array( 'status' => 400 ) );
}
$coupon->set_code( $coupon_code );
break;
case 'meta_data' :
if ( is_array( $value ) ) {
foreach ( $value as $meta ) {
$coupon->update_meta_data( $meta['key'], $meta['value'], $meta['id'] );
}
}
break;
case 'description' :
$coupon->set_description( wp_filter_post_kses( $value ) );
break;
default :
if ( is_callable( array( $coupon, "set_{$key}" ) ) ) {
$coupon->{"set_{$key}"}( $value );
}
break;
}
}
$coupon->set_code( $coupon_code );
}
// Coupon description (excerpt).
if ( ! empty( $schema['properties']['description'] ) && isset( $request['description'] ) ) {
$coupon->set_description( wp_filter_post_kses( $request['description'] ) );
}
/**
@ -253,8 +261,7 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
* The dynamic portion of the hook name, $this->post_type, refers to post_type of the post being
* prepared for insertion.
*
* @param stdClass $data An object representing a single item prepared
* for inserting or updating the database.
* @param WC_Coupon $coupon The coupon object.
* @param WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $coupon, $request );
@ -305,195 +312,51 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
* @return WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
$post_id = (int) $request['id'];
try {
$post_id = (int) $request['id'];
if ( empty( $post_id ) || $this->post_type !== get_post_type( $post_id ) ) {
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) );
if ( empty( $post_id ) || $this->post_type !== get_post_type( $post_id ) ) {
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) );
}
$coupon_id = $this->save_coupon( $request );
if ( is_wp_error( $coupon_id ) ) {
return $coupon_id;
}
$post = get_post( $coupon_id );
$this->update_additional_fields_for_object( $post, $request );
/**
* Fires after a single item is created or updated via the REST API.
*
* @param object $post Inserted object (not a WP_Post object).
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
$request->set_param( 'context', 'edit' );
$response = $this->prepare_item_for_response( $post, $request );
return rest_ensure_response( $response );
} catch ( Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
$coupon_id = $this->save_coupon( $request );
if ( is_wp_error( $coupon_id ) ) {
return $coupon_id;
}
$post = get_post( $coupon_id );
$this->update_additional_fields_for_object( $post, $request );
$this->update_post_meta_fields( $post, $request );
/**
* Fires after a single item is created or updated via the REST API.
*
* @param object $post Inserted object (not a WP_Post object).
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
$request->set_param( 'context', 'edit' );
$response = $this->prepare_item_for_response( $post, $request );
return rest_ensure_response( $response );
}
/**
* Saves a coupon to the database.
*/
public function save_coupon( $request ) {
$coupon = $this->prepare_item_for_database( $request );
$coupon->save();
return $coupon->get_id();
}
/**
* Expiry date format.
*
* @param string $expiry_date
* @return string
*/
protected function get_coupon_expiry_date( $expiry_date ) {
if ( '' != $expiry_date ) {
return date( 'Y-m-d', strtotime( $expiry_date ) );
}
return '';
}
/**
* Add post meta fields.
*
* @param WP_Post $post
* @param WP_REST_Request $request
* @return bool|WP_Error
*/
protected function add_post_meta_fields( $post, $request ) {
$data = array_filter( $request->get_params() );
$defaults = array(
'discount_type' => 'fixed_cart',
'amount' => 0,
'individual_use' => false,
'product_ids' => array(),
'exclude_product_ids' => array(),
'usage_limit' => '',
'usage_limit_per_user' => '',
'limit_usage_to_x_items' => '',
'usage_count' => '',
'expiry_date' => '',
'free_shipping' => false,
'product_categories' => array(),
'excluded_product_categories' => array(),
'exclude_sale_items' => false,
'minimum_amount' => '',
'maximum_amount' => '',
'email_restrictions' => array(),
'description' => ''
);
$data = wp_parse_args( $data, $defaults );
if ( ! empty( $post->post_title ) ) {
$coupon = new WC_Coupon( $post->post_title );
// Set coupon meta.
$coupon->set_discount_type( $data['discount_type'] );
$coupon->set_amount( $data['amount'] );
$coupon->set_individual_use( $data['individual_use'] );
$coupon->set_product_ids( $data['product_ids'] );
$coupon->set_excluded_product_ids( $data['exclude_product_ids'] );
$coupon->set_usage_limit( $data['usage_limit'] );
$coupon->set_usage_limit_per_user( $data['usage_limit_per_user'] );
$coupon->set_limit_usage_to_x_items( $data['limit_usage_to_x_items'] );
$coupon->set_usage_count( $data['usage_count'] );
$coupon->set_expiry_date( $data['expiry_date'] );
$coupon->set_free_shipping( $data['free_shipping'] );
$coupon->set_product_categories( $data['product_categories'] );
$coupon->set_excluded_product_categories( $data['excluded_product_categories'] );
$coupon->set_exclude_sale_items( $data['exclude_sale_items'] );
$coupon->set_minimum_amount( $data['minimum_amount'] );
$coupon->set_maximum_amount( $data['maximum_amount'] );
$coupon->set_email_restrictions( $data['email_restrictions'] );
try {
$coupon = $this->prepare_item_for_database( $request );
$coupon->save();
return $coupon->get_id();
} catch ( WC_Data_Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
} catch ( WC_REST_Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
return true;
}
/**
* Update post meta fields.
*
* @param WP_Post $post
* @param WP_REST_Request $request
* @return bool|WP_Error
*/
protected function update_post_meta_fields( $post, $request ) {
$coupon = new WC_Coupon( $post->post_title );
if ( isset( $request['amount'] ) ) {
$coupon->set_amount( $request['amount'] );
}
if ( isset( $request['individual_use'] ) ) {
$coupon->set_individual_use( $request['individual_use'] );
}
if ( isset( $request['product_ids'] ) ) {
$coupon->set_product_ids( $request['product_ids'] );
}
if ( isset( $request['exclude_product_ids'] ) ) {
$coupon->set_excluded_product_ids( $request['exclude_product_ids'] );
}
if ( isset( $request['usage_limit'] ) ) {
$coupon->set_usage_limit( $request['usage_limit'] );
}
if ( isset( $request['usage_limit_per_user'] ) ) {
$coupon->set_usage_limit_per_user( $request['usage_limit_per_user'] );
}
if ( isset( $request['limit_usage_to_x_items'] ) ) {
$coupon->set_limit_usage_to_x_items( $request['limit_usage_to_x_items'] );
}
if ( isset( $request['usage_count'] ) ) {
$coupon->set_usage_count( $request['usage_count'] );
}
if ( isset( $request['expiry_date'] ) ) {
$coupon->set_expiry_date( $request['expiry_date'] );
}
if ( isset( $request['free_shipping'] ) ) {
$coupon->set_free_shipping( $request['free_shipping'] );
}
if ( isset( $request['product_categories'] ) ) {
$coupon->set_product_categories( $request['product_categories'] );
}
if ( isset( $request['excluded_product_categories'] ) ) {
$coupon->set_excluded_product_categories( $request['excluded_product_categories'] );
}
if ( isset( $request['exclude_sale_items'] ) ) {
$coupon->set_exclude_sale_items( $request['exclude_sale_items'] );
}
if ( isset( $request['minimum_amount'] ) ) {
$coupon->set_minimum_amount( $request['minimum_amount'] );
}
if ( isset( $request['maximum_amount'] ) ) {
$coupon->set_maximum_amount( $request['maximum_amount'] );
}
if ( isset( $request['email_restrictions'] ) ) {
$coupon->set_email_restrictions( $request['email_restrictions'] );
}
$coupon->save();
return true;
}
/**
@ -502,7 +365,6 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
* @return array
*/
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => $this->post_type,
@ -548,7 +410,7 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'expiry_date' => array(
'date_expires' => array(
'description' => __( 'UTC DateTime when the coupon expires.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
@ -570,7 +432,7 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
'type' => 'array',
'context' => array( 'view', 'edit' ),
),
'exclude_product_ids' => array(
'excluded_product_ids' => array(
'description' => __( "List of product ID's the coupon cannot be used on.", 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
@ -633,9 +495,31 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'meta_data' => array(
'description' => __( 'Order meta data.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'properties' => array(
'id' => array(
'description' => __( 'Meta ID.', 'woocommerce' ),
'type' => 'int',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'key' => array(
'description' => __( 'Meta key.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'value' => array(
'description' => __( 'Meta value.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
),
),
),
);
return $this->add_additional_fields_schema( $schema );
}
@ -646,14 +530,12 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
*/
public function get_collection_params() {
$params = parent::get_collection_params();
$params['code'] = array(
'description' => __( 'Limit result set to resources with a specific code.', 'woocommerce' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg',
);
return $params;
}
}

View File

@ -117,7 +117,6 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
if ( ! wc_rest_check_user_permissions( 'read' ) ) {
return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
@ -131,7 +130,6 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
if ( ! wc_rest_check_user_permissions( 'create' ) ) {
return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
@ -147,7 +145,6 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
if ( ! wc_rest_check_user_permissions( 'read', $id ) ) {
return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
@ -163,7 +160,6 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
if ( ! wc_rest_check_user_permissions( 'edit', $id ) ) {
return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
@ -179,7 +175,6 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
if ( ! wc_rest_check_user_permissions( 'delete', $id ) ) {
return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
@ -193,7 +188,6 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
if ( ! wc_rest_check_user_permissions( 'batch' ) ) {
return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
@ -301,49 +295,53 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
* @return WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
if ( ! empty( $request['id'] ) ) {
return new WP_Error( 'woocommerce_rest_customer_exists', __( 'Cannot create existing resource.', 'woocommerce' ), array( 'status' => 400 ) );
try {
if ( ! empty( $request['id'] ) ) {
throw new WC_REST_Exception( 'woocommerce_rest_customer_exists', __( 'Cannot create existing resource.', 'woocommerce' ), 400 );
}
// Sets the username.
$request['username'] = ! empty( $request['username'] ) ? $request['username'] : '';
// Sets the password.
$request['password'] = ! empty( $request['password'] ) ? $request['password'] : '';
// Create customer.
$customer = new WC_Customer;
$customer->set_username( $request['username'] );
$customer->set_password( $request['password'] );
$customer->set_email( $request['email'] );
$customer->create();
if ( ! $customer->get_id() ) {
throw new WC_REST_Exception( 'woocommerce_rest_cannot_create', __( 'This resource cannot be created.', 'woocommerce' ), 400 );
}
$this->update_customer_meta_fields( $customer, $request );
$customer->save();
$user_data = get_user_by( 'id', $customer->get_id() );
$this->update_additional_fields_for_object( $user_data, $request );
/**
* Fires after a customer is created or updated via the REST API.
*
* @param WP_User $user_data Data used to create the customer.
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating customer, false when updating customer.
*/
do_action( 'woocommerce_rest_insert_customer', $user_data, $request, true );
$request->set_param( 'context', 'edit' );
$response = $this->prepare_item_for_response( $user_data, $request );
$response = rest_ensure_response( $response );
$response->set_status( 201 );
$response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $customer->get_id() ) ) );
return $response;
} catch ( Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
// Sets the username.
$request['username'] = ! empty( $request['username'] ) ? $request['username'] : '';
// Sets the password.
$request['password'] = ! empty( $request['password'] ) ? $request['password'] : '';
// Create customer.
$customer = new WC_Customer;
$customer->set_username( $request['username'] );
$customer->set_password( $request['password'] );
$customer->set_email( $request['email'] );
$customer->create();
if ( ! $customer->get_id() ) {
return new WP_Error( 'woocommerce_rest_cannot_create', __( 'This resource cannot be created.', 'woocommerce' ), array( 'status' => 400 ) );
}
$this->update_customer_meta_fields( $customer, $request );
$customer->save();
$user_data = get_user_by( 'id', $customer->get_id() );
$this->update_additional_fields_for_object( $user_data, $request );
/**
* Fires after a customer is created or updated via the REST API.
*
* @param WP_User $user_data Data used to create the customer.
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating customer, false when updating customer.
*/
do_action( 'woocommerce_rest_insert_customer', $user_data, $request, true );
$request->set_param( 'context', 'edit' );
$response = $this->prepare_item_for_response( $user_data, $request );
$response = rest_ensure_response( $response );
$response->set_status( 201 );
$response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $customer->get_id() ) ) );
return $response;
}
/**
@ -373,50 +371,54 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
* @return WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
$id = (int) $request['id'];
$customer = new WC_Customer( $id );
try {
$id = (int) $request['id'];
$customer = new WC_Customer( $id );
if ( ! $customer->get_id() ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 400 ) );
if ( ! $customer->get_id() ) {
throw new WC_REST_Exception( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), 400 );
}
if ( ! empty( $request['email'] ) && email_exists( $request['email'] ) && $request['email'] !== $customer->get_email() ) {
throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce' ), 400 );
}
if ( ! empty( $request['username'] ) && $request['username'] !== $customer->get_username() ) {
throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce' ), 400 );
}
// Customer email.
if ( isset( $request['email'] ) ) {
$customer->set_email( sanitize_email( $request['email'] ) );
}
// Customer password.
if ( isset( $request['password'] ) ) {
$customer->set_password( wc_clean( $request['password'] ) );
}
$this->update_customer_meta_fields( $customer, $request );
$customer->save();
$user_data = get_userdata( $customer->get_id() );
$this->update_additional_fields_for_object( $user_data, $request );
/**
* Fires after a customer is created or updated via the REST API.
*
* @param WP_User $customer Data used to create the customer.
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating customer, false when updating customer.
*/
do_action( 'woocommerce_rest_insert_customer', $user_data, $request, false );
$request->set_param( 'context', 'edit' );
$response = $this->prepare_item_for_response( $user_data, $request );
$response = rest_ensure_response( $response );
return $response;
} catch ( Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
if ( ! empty( $request['email'] ) && email_exists( $request['email'] ) && $request['email'] !== $customer->get_email() ) {
return new WP_Error( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce' ), array( 'status' => 400 ) );
}
if ( ! empty( $request['username'] ) && $request['username'] !== $customer->get_username() ) {
return new WP_Error( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce' ), array( 'status' => 400 ) );
}
// Customer email.
if ( isset( $request['email'] ) ) {
$customer->set_email( sanitize_email( $request['email'] ) );
}
// Customer password.
if ( isset( $request['password'] ) ) {
$customer->set_password( wc_clean( $request['password'] ) );
}
$this->update_customer_meta_fields( $customer, $request );
$customer->save();
$user_data = get_userdata( $customer->get_id() );
$this->update_additional_fields_for_object( $user_data, $request );
/**
* Fires after a customer is created or updated via the REST API.
*
* @param WP_User $customer Data used to create the customer.
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating customer, false when updating customer.
*/
do_action( 'woocommerce_rest_insert_customer', $user_data, $request, false );
$request->set_param( 'context', 'edit' );
$response = $this->prepare_item_for_response( $user_data, $request );
$response = rest_ensure_response( $response );
return $response;
}
/**
@ -484,62 +486,35 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $user_data, $request ) {
$customer = new WC_Customer( $user_data->ID );
$last_order_data = $customer->get_last_order();
$last_order = null;
$customer = new WC_Customer( $user_data->ID );
$data = $customer->get_data();
$format_date = array( 'date_created', 'date_modified' );
if ( $last_order_data ) {
$last_order = array(
// Format date values.
foreach ( $format_date as $key ) {
$data[ $key ] = $data[ $key ] ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $data[ $key ] ) ) ) : null;
}
// Remove unwanted CRUD data.
unset( $data['role'] );
// Additional non-crud data.
$data['last_order'] = null;
$data['orders_count'] = $customer->get_order_count();
$data['total_spent'] = $customer->get_total_spent();
$data['avatar_url'] = $customer->get_avatar_url();
if ( $last_order_data = $customer->get_last_order() ) {
$data['last_order'] = array(
'id' => $last_order_data->get_id(),
'date' => wc_rest_prepare_date_response( $last_order_data->get_date_created() ),
'date' => $last_order_data->get_date_created() ? wc_rest_prepare_date_response( $last_order_data->get_date_created() ) : null,
);
}
$data = array(
'id' => $customer->get_id(),
'date_created' => wc_rest_prepare_date_response( date( 'Y-m-d H:i:s', $customer->get_date_created() ) ),
'date_modified' => $customer->get_date_modified() ? wc_rest_prepare_date_response( date( 'Y-m-d H:i:s', $customer->get_date_modified() ) ) : null,
'email' => $customer->get_email(),
'first_name' => $customer->get_first_name(),
'last_name' => $customer->get_last_name(),
'username' => $customer->get_username(),
'last_order' => $last_order,
'orders_count' => $customer->get_order_count(),
'total_spent' => $customer->get_total_spent(),
'avatar_url' => $customer->get_avatar_url(),
'billing' => array(
'first_name' => $customer->get_billing_first_name(),
'last_name' => $customer->get_billing_last_name(),
'company' => $customer->get_billing_company(),
'address_1' => $customer->get_billing_address_1(),
'address_2' => $customer->get_billing_address_2(),
'city' => $customer->get_billing_city(),
'state' => $customer->get_billing_state(),
'postcode' => $customer->get_billing_postcode(),
'country' => $customer->get_billing_country(),
'email' => $customer->get_billing_email(),
'phone' => $customer->get_billing_phone(),
),
'shipping' => array(
'first_name' => $customer->get_shipping_first_name(),
'last_name' => $customer->get_shipping_last_name(),
'company' => $customer->get_shipping_company(),
'address_1' => $customer->get_shipping_address_1(),
'address_2' => $customer->get_shipping_address_2(),
'city' => $customer->get_shipping_city(),
'state' => $customer->get_shipping_state(),
'postcode' => $customer->get_shipping_postcode(),
'country' => $customer->get_shipping_country(),
),
);
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );
// Wrap the data in a response object.
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );
$response = rest_ensure_response( $data );
$response->add_links( $this->prepare_links( $user_data ) );
/**
@ -561,6 +536,15 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
protected function update_customer_meta_fields( $customer, $request ) {
$schema = $this->get_item_schema();
// Meta data
if ( isset( $request['meta_data'] ) ) {
if ( is_array( $request['meta_data'] ) ) {
foreach ( $request['meta_data'] as $meta ) {
$coupon->update_meta_data( $meta['key'], $meta['value'], $meta['id'] );
}
}
}
// Customer first name.
if ( isset( $request['first_name'] ) ) {
$customer->set_first_name( wc_clean( $request['first_name'] ) );
@ -826,6 +810,35 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
),
),
),
'is_paying_customer' => array(
'description' => __( 'Is the customer a paying customer?', 'woocommerce' ),
'type' => 'bool',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'meta_data' => array(
'description' => __( 'Order meta data.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'properties' => array(
'id' => array(
'description' => __( 'Meta ID.', 'woocommerce' ),
'type' => 'int',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'key' => array(
'description' => __( 'Meta key.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'value' => array(
'description' => __( 'Meta value.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
),
),
),
);
@ -839,7 +852,6 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
*/
protected function get_role_names() {
global $wp_roles;
return array_keys( $wp_roles->role_names );
}

View File

@ -317,7 +317,7 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
if ( ! empty( $order_ids ) ) {
unset( $args['s'] );
$args['post__in'] = array_merge( $order_ids, array( 0 ) );
$args['post__in'] = array_merge( $order_ids, array( 0 ) );
}
}
@ -458,7 +458,7 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
}
// If items have changed, recalculate order totals.
if ( isset( $request[ 'billing' ], $request[ 'shipping' ], $request[ 'line_items' ], $request[ 'shipping' ], $request[ 'fee' ], $request[ 'coupon' ] ) ) {
if ( isset( $request['billing'], $request['shipping'], $request['line_items'], $request['shipping'], $request['fee'], $request['coupon'] ) ) {
$order->calculate_totals();
}

Some files were not shown because too many files have changed in this diff Show More